#include <bits/stdc++.h>
using namespace std;
int a[55];
void DW(long long m, long long cnt, int l, int r, int x) {
  cnt /= 2;
  if (m > cnt) {
    a[r] = x;
    m -= cnt;
    r--;
  } else {
    a[l] = x;
    l++;
  }
  if (l > r) return;
  DW(m, cnt, l, r, x + 1);
}
int main() {
  long long n, m;
  long long cnt;
  while (~scanf("%I64d%I64d", &n, &m)) {
    cnt = 1;
    for (int i = 1; i < n; i++) {
      cnt *= 2;
    }
    DW(m, cnt, 1, n, 1);
    for (int i = 1; i < n; i++) {
      printf("%d ", a[i]);
    }
    printf("%d\n", a[n]);
  }
  return 0;
}
