#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long m;
  cin >> n >> m;
  int ans[n];
  for (int i = 0; i < n; ++i) {
    ans[i] = 0;
  }
  int left = 0, right = n - 1;
  for (int i = 1; i <= n; ++i) {
    if (m <= (1LL << (n - i - 1))) {
      ans[left] = i;
      ++left;
    } else {
      ans[right] = i;
      --right;
      m -= (1LL << (n - i - 1));
    }
  }
  cout << ans[0];
  for (int i = 1; i < n; ++i) {
    cout << ' ' << ans[i];
  }
  cout << endl;
  return 0;
}
