#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:128000000")
int n;
long long m;
int ans[1 << 6];
void rec(int n, long long m, int l, int r, int d) {
  if (!n) return;
  long long p2 = (1LL << (n - 1));
  if ((m << 1) < p2) {
    ans[l] = d;
    rec(n - 1, m, l + 1, r, d + 1);
  } else {
    ans[r] = d;
    rec(n - 1, m - (p2 >> 1), l, r - 1, d + 1);
  }
}
int main() {
  cin >> n >> m;
  --m;
  rec(n, m, 0, n - 1, 1);
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
