#include<iostream>
using namespace std;
const int N = 30;
int n, m;
int res[N];
void dfs(int cur, int num){//当前在第cur位,当前的数字是多少
if(cur > m + 1 || num > n + 1) return;
if(cur == m + 1){
for(int i = 1; i <= m; i++){
cout << res[i] << " ";
}
cout << endl;
return;
}
res[cur] = num;
dfs(cur + 1, num + 1);
res[cur] = 0;
dfs(cur, num + 1);
}
int main(){
cin >> n >> m;
dfs(1, 1);
return 0;
}