#include <bits/stdc++.h>
int main() {
  long long unsigned e;
  unsigned n, i, j, k, N, R[55];
  scanf("%u%I64u", &n, &e);
  --e;
  for (N = n, i = k = 1, j = n--; i < j;) {
    if (e >= (1llu << --n)) {
      e -= 1llu << n;
      R[j--] = k++;
    } else
      R[i++] = k++;
  }
  for (R[i] = k, i = 0; ++i <= N;) printf("%u%c", R[i], i == N ? '\n' : ' ');
  return 0;
}
