#include <bits/stdc++.h>
using namespace std;
void init_cin() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
int main() {
  init_cin();
  int n;
  long long k;
  cin >> n >> k;
  k--;
  vector<int> ans(n);
  int r = n - 1;
  int l = 1;
  for (int i = 0; i < n && l <= n; i++) {
    while (l < n && (1LL << (n - 1 - l)) <= k) {
      k -= 1LL << (n - 1 - l);
      ans[r--] = l++;
    }
    ans[i] = l++;
  }
  for (int i : ans) {
    cout << i << " ";
  }
  return 0;
}
