#include<bits/stdc++.h>
using namespace std;
int n, k;
vector<int> a;
bool urmator() {
for (int i = k; i >= 1; i--) {
// Maximum allowed value at position i
if (a[i] < n - k + i) {
a[i]++;
// Reset positions to the right
for (int j = i + 1; j <= k; j++)
a[j] = a[j - 1] + 1;
return true;
}
}
return false;
}
int main() {
ifstream cin("combinari.in");
ifstream cout("combinari.out");
cin >> n >> k;
a.resize(k + 1);
// First combination: 1, 2, ..., k
for (int i = 1; i <= k; i++)
a[i] = i;
do {
for (int i = 1; i <= k; i++)
cout << a[i] << " ";
cout << '\n';
} while (urmator());
}