import java.util.Scanner;
public class Main {
static StringBuilder sb = new StringBuilder();
static int N, M ;
static int[] select;
static void rec_func(int k) {
if(k == M+1) {
for(int i=1; i<=M; i++) {
sb.append(select[i]).append(' ');
}
sb.append('\n');
}else {
int start = select[k-1]+1;
for(int j=start; j<=N; j++) {
select[k]= j;
rec_func(k+1);
select[k] = 0;
}
}
}
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
N = kb.nextInt();
M = kb.nextInt();
select = new int[N+1];
rec_func(1);
System.out.print(sb);
}
}