#include <bits/stdc++.h>
using namespace std;
const int N = 25;
int state[N];
int path[N];
int n, m;
// 组合的深度优先搜索
void dfs(int u, int k) {
if (u == m) {
for (int i = 0; i < m; i++) {
cout << path[i] << " ";
}
cout << endl;
return;
}
for (int i = k; i <= n; i++) {
path[u] = i;
state[i] = 1;
dfs(u + 1, i + 1);
state[i] = 0;
}
}
int main() {
cin >> n >> m;
memset(state, 0, sizeof(state));
dfs(0, 1);
return 0;
}