#include <bits/stdc++.h>
using namespace std;
int best[8];
int qbest[8];
int p[8] = {};
int f(int q) {
  int ret = 0;
  for (int i = 0; i < q; ++i) {
    for (int j = 0; j <= i; ++j) {
      int v = 1 << 30;
      for (int k = j; k <= i; ++k) {
        v = min(v, p[k]);
      }
      ret += v;
    }
  }
  return ret;
}
void DFS(int n, long long m, int v) {
  if (!n) {
    cout << v << " ";
    return;
  }
  --n;
  if ((1LL << n) > m) {
    cout << v << " ";
    DFS(n, m, v + 1);
  } else {
    DFS(n, m - (1LL << n), v + 1);
    cout << v << " ";
  }
}
int main() {
  int n;
  long long m;
  cin >> n >> m;
  --m;
  --n;
  DFS(n, m, 1);
  return 0;
}
