#include<iostream>
#include<iomanip>
int count(int x) {
int n = 0;
while (x != 0) {
if (x % 2 != 0) n++;
x /= 2;
}
return n;
}
using namespace std;
int main() {
int n, r;
cin >> n >> r;
int U, S;
U = (1 << n) - 1;
for (S = U; S >= 0; S--) {
if (count(S) == r) {
int m = 0;
for (int i = n-1; i >= 0; i--) {
if ((1 << i) & S) {
cout << setw(3) << n - i ;
m++;
}
if (m == r) {
cout << endl;
break;
}
}
}
}
}