#include <bits/stdc++.h>
using namespace std;
long long n, m, a[60];
int main() {
  cin >> n >> m;
  int f = 1, e = n;
  m = 2 * m - 2;
  for (int i = n; i >= 1; --i) {
    if ((1ll << (i - 1)) & m)
      a[e] = n - i + 1, e--;
    else
      a[f] = n - i + 1, f++;
  }
  for (int i = 1; i <= n; ++i) cout << a[i] << " ";
  cout << endl;
}
