import java.util.Scanner;
public class Main{
static int n, m , state[] = new int[30];
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
dfs(1,1);
}
static void dfs(int u, int start){
if(u > m){
for(int i = 1; i <= m; i++){
System.out.print(state[i] + " ");
}
System.out.println();
}
else{
for(int i = start; i <=n; i ++){
state[u] = i;
dfs(u + 1, i + 1);
state[i] = 0;
}
}
}
}