#include <bits/stdc++.h>
using namespace std;
long long m;
long long n;
long long ans[50 + 5];
int main() {
  cin >> n >> m;
  m--;
  long long begin = 1, end = n;
  for (int x = n - 2; x + 1; --x) {
    if (m & (1ll << x)) {
      ans[end--] = n - 1 - x;
    } else {
      ans[begin++] = n - 1 - x;
    }
  }
  ans[end] = n;
  for (int x = 1; x <= n; ++x) cout << ans[x] << " ";
  cout << endl;
}
