#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> V;
  V.push_back(1);
  for (int i = 2; i <= n; ++i) {
    int idx = 0;
    for (int j = 0; j < V.size(); ++j)
      if (V[j] == i - 1) idx = j;
    if (m <= (1LL << (n - i))) {
      if (idx == V.size()) {
        V.insert(V.begin() + (idx + 1), i);
      } else {
        V.insert(V.begin() + (idx + 1), i);
      }
    } else {
      m -= (1LL << (n - i));
      V.insert(V.begin() + idx, i);
    }
  }
  for (int i = 0; i < V.size(); ++i) cout << V[i] << " ";
  return 0;
}
