#include <bits/stdc++.h>
using namespace std;
long long n, m, used[1 << 20], rem;
vector<long long> ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  --m;
  for (int i = 1; i <= n; i++) {
    rem = (1ll << (n - i - 1));
    if (rem <= m) {
      m -= rem;
      continue;
    }
    ans.push_back(i);
    used[i] = 1;
  }
  for (int i = n; i; --i)
    if (used[i] == 0) ans.push_back(i);
  for (int i = 0; i < ans.size(); i++) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  cin.get();
  cin.get();
  return 0;
}
