#include <bits/stdc++.h>
long long hehe[55];
long long ans[55];
int main() {
  long long n, m;
  hehe[0] = 1;
  for (int i = 1; i <= 51; i++) {
    hehe[i] = hehe[i - 1] * 2;
  }
  while (~scanf("%I64d%I64d", &n, &m)) {
    for (long long i = 1, j = 1, k = n; i <= n; i++) {
      long long haha = hehe[n - i - 1];
      if (m <= haha) {
        ans[j] = i;
        j++;
      } else {
        m -= haha;
        ans[k] = i;
        k--;
      }
    }
    for (long long i = 1; i <= n; i++) {
      printf("%I64d ", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
