#include <iostream>
using namespace std;
int m;
int n;
bool tag[26];
void dfs(int c,int d) {
if (c > n+1)
return;
if (d == m) {
for (int i = 1; i <= n; ++i) {
if (tag[i] == true){
cout<<i<<' ';
}
}
cout<<endl;
return;
}
tag[c] = true;
dfs(c + 1,d+1);
tag[c] = false;
tag[c] = false;
dfs(c + 1,d);
}
int main()
{
cin>>n>>m;
dfs(1,0);
return 0;
}