#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
int n, a[MAXN];
long long m;
int main() {
  cin >> n >> m;
  long long cnt = 1LL << (n - 1);
  int L = 0, R = n - 1;
  for (int i = 1; i <= n; ++i) {
    if (m > cnt / 2) {
      a[R] = i;
      --R;
      m -= cnt / 2;
    } else {
      a[L] = i;
      ++L;
    }
    cnt >>= 1;
  }
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
}
