#include <bits/stdc++.h>
using namespace std;
const int MAXN = 64;
int n;
long long m;
int a[MAXN];
long long twos[MAXN];
int main() {
  cin >> n >> m;
  twos[0] = 1;
  for (int i = 1; i <= n; i++) twos[i] = twos[i - 1] * 2ll;
  int fst = 1;
  int snd = n;
  for (int k = 1; k < n; k++) {
    int sp = n - k;
    if (m <= twos[sp - 1]) {
      a[fst++] = k;
    } else {
      m -= twos[sp - 1];
      a[snd--] = k;
    }
  }
  assert(fst == snd);
  a[fst] = n;
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
