#include <bits/stdc++.h>
int main() {
  int n, p, j;
  int a[50];
  long long k = 1, m;
  scanf("%d %I64d", &n, &m);
  p = 0;
  j = n - 1;
  for (int i = 1; i < n; i++) {
    k *= 2;
  }
  for (int i = 1; i <= n; i++, k = k / 2) {
    if (m - k / 2 > 0) {
      a[j] = i;
      m = m - k / 2;
      j--;
    } else {
      a[p] = i;
      p++;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
