#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
int soln[51];
long long mr = 0;
int main() {
  cin >> n >> m;
  --m;
  for (int k = 1; k < n; ++k) {
    mr = mr * 2 + (m & 1);
    m >>= 1;
  }
  int i = 1, j = n;
  for (int k = 1; k <= n; ++k) {
    if (mr & 1)
      soln[j--] = k;
    else
      soln[i++] = k;
    mr >>= 1;
  }
  for (int k = 1; k <= n; ++k) cout << soln[k] << ' ';
  cout << endl;
}
