#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, r;
int ans[N];
bool used[N];
int combine(int k)
{
for(int i = ans[k-1]+1;i <= n;i++)
{
if(!used[i])
{
ans[k] = i;
used[i] = 1;
if(k == r)
{
for(int j = 1;j <= r;j++)
{
cout << setw(3) << ans[j];
}
cout << endl;
}
else
{
combine(k+1);
}
used[i] = 0;
}
}
}
int main()
{
cin >> n >> r;
combine(1);
return 0;
}