#include<bits/stdc++.h>
using namespace std;
int main(){
int n, r;
cin >> n >> r;
for (int i = 0; i <=(1 << n); i++) {
int num = 0, kk = i;
while (kk) {
kk = kk & (kk - 1);
num++;
}
if (num == r) {
for (int j = 1; j <= n; j++) {
if (i & (1 << j)) {
cout << " " << j;
}
}cout << endl;
}
}
}