#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 1e6;
int n,m;
int res[N];
void dfs(int cur,int start){
if(cur + n - start < m) return;
if(cur > m){
for(int i = 1; i <= m; i++){
cout << res[i] << " ";
}
cout << endl;
return;
}
for(int i = start; i <= n; i++){
res[cur] = i;
dfs(cur + 1, i + 1);
res[cur] = 0;
}
}
int main(){
cin >> n >> m;
//int start_max = n - m + 1;
dfs(1,1);
return 0;
}