#include <bits/stdc++.h>
using namespace std;
const int MAXN = 60;
int ans[MAXN];
int main() {
  int n;
  long long m;
  cin >> n >> m;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  m--;
  int l = 0, r = n - 1;
  int cur = 1;
  for (int i = n - 2; i >= 0; i--) {
    if (m >= (1ll << i)) {
      ans[r--] = cur++;
      m -= (1ll << i);
    } else
      ans[l++] = cur++;
  }
  ans[l] = n;
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
