#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans[51];
  long long n, m;
  cin >> n >> m;
  long long cnt = 1LL << (n - 1);
  int h = 1, t = n, Min = 1;
  for (int i = 1; i <= n; i++) {
    cnt >>= 1;
    if (m <= cnt) {
      ans[h++] = Min++;
    } else {
      m -= cnt;
      ans[t--] = Min++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
