#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 25;
int n, m;
int way[N];
void dfs(int u, int start)
{
if (u - 1 + n - start + 1 < m) return; // 剪枝
if (u == m + 1)
{
for (int i = 1; i <= m; i++)
printf("%d ", way[i]);
puts(" ");
return;
}
for (int i = start; i <= n; i++)
{
way[u] = i;
dfs(u + 1, i + 1);
way[u] = 0;
}
}
int main()
{
cin >> n >> m;
dfs(1, 1);
return 0;
}