#include <bits/stdc++.h>
using namespace std;
long long a[60], first[60];
long long n, m;
set<pair<long long, long long> > st;
void rec(long long x) {
  st.clear();
  if (x == n + 1) {
    for (long long i = 1; i <= n; ++i) cout << a[i] << ' ';
    return;
  }
  for (long long i = 1; i <= n; ++i) {
    if (!a[i]) {
      long long pr = i;
      while (a[pr] == 0 && pr >= 1ll) pr--;
      pr++;
      long long nx = i;
      while (a[nx] == 0 && nx <= n) nx++;
      nx--;
      st.insert(make_pair((nx - i + 1) * (i - pr + 1), i));
    }
  }
  long long pos = 1;
  if (n - x - 1 >= 0)
    pos = (m + first[n - x - 1] - 1ll) / first[n - x - 1];
  else
    pos = 1;
  if (n - x - 1 >= 0 && m >= first[n - x - 1]) m -= first[n - x - 1];
  if (m == 0) m = first[n - x - 1];
  for (set<pair<long long, long long> >::iterator it = st.begin();
       it != st.end(); ++it) {
    pos--;
    if (pos == 0) {
      a[(it->second)] = x;
      rec(x + 1);
      break;
    }
  }
}
int main() {
  cin >> n >> m;
  first[0] = 1;
  for (long long i = 1; i <= n; ++i) first[i] = 2ll * first[i - 1];
  rec(1);
}
