#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
long long cnt[60];
int fin[60];
int com = 0;
int main() {
  scanf("%d %I64d", &n, &k);
  cnt[0] = 1;
  cnt[1] = 1;
  cnt[2] = 2;
  for (int i = 2; i <= n; i++) {
    cnt[i] = cnt[i - 1] * 2;
  }
  int fim = n - 1;
  int inc = 0;
  for (int i = 1; i <= n; i++) {
    if (cnt[n - i] >= k) {
      fin[com++] = i;
    } else {
      k -= cnt[n - i];
      fin[fim--] = i;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", fin[i]);
}
