#include <bits/stdc++.h>
using namespace std;
int a[200], n;
long long m, f[200];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  f[1] = 1;
  for (int i = 2; i <= n; i++) f[i] = f[i - 1] * 2;
  int l = 1;
  int r = n;
  int nn = n;
  int v = 0;
  while (l <= r) {
    v++;
    if (f[nn - 1] >= m) {
      a[l] = v;
      l++;
    } else {
      m -= f[nn - 1];
      a[r] = v;
      r--;
    }
    nn--;
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
