#include <bits/stdc++.h>
using namespace std;
void fix(long long mth, int beg, int end, vector<int>::iterator begp,
         vector<int>::iterator endp) {
  int n = end - beg + 1;
  long long ncnt = 1LL << (n - 1);
  assert(mth <= ncnt);
  if (n == 1) {
    assert(begp == endp);
    assert(beg == end);
    assert(mth == 1);
    *begp = beg;
    return;
  }
  if (mth <= ncnt / 2) {
    *begp = beg;
    ++begp;
  } else {
    *endp = beg;
    --endp;
    mth -= ncnt / 2;
  }
  ++beg;
  fix(mth, beg, end, begp, endp);
}
int main() {
  int n;
  long long m;
  while (cin >> n >> m) {
    vector<int> perm(n);
    fix(m, 1, n, perm.begin(), perm.end() - 1);
    for (int i = 0; i < n; ++i) cout << perm[i] << " ";
    cout << endl;
  }
  return 0;
}
