import java.util.Scanner;
public class Main_15652 {
static int N, M;
static int[] answer;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
N = scan.nextInt();//전체 데이터 개수(자연수)
M = scan.nextInt();//선택할 데이터 개수
answer = new int[M];//선택 데이터가 담길 배열
combi(0,1);//인자두개!! 첫번째 인자:선택된 개수(depth) , 두번째 인자: 시작위치(start)
scan.close();
}//main
private static void combi(int depth, int start) {
if(depth == M) { //주어진 선택(의 갯수가)이 끝났다면
for(int num :answer) {
System.out.print(num+" ");
}
System.out.println();
return;
}
for(int i= start ; i<=N; i++) {//for문 ==> 전체 데이터 (1부터 시작하는 자연수를 의미)
answer[depth]=i;//정답(선택)배열에 값 채우기
combi(depth+1, i); //중복조합을 만들기 위하여 i+1을 i로 변경 해 준다!!
}
}
}