#include <iostream>
#include <iomanip>
using namespace std;
int n, q;
int ans[25];
void dfs(int start, int u) {
if (u == q+1) {
for (int i = 1; i <= q; i++) cout << setw(3) << ans[i];
cout << endl;
return;
}
for (int i = start; i <= n; i++) {
ans[u] = i;
dfs(i + 1, u + 1);
}
}
int main() {
cin >> n >> q;
dfs(1, 1);
return 0;
}