#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long ans[51];
bool used[51];
int main() {
  scanf("%I64d%I64d", &n, &m);
  long long i = 1, last = 1, cnt = n - 2;
  for (; i <= n && last <= n;) {
    if ((1LL << cnt) >= m) {
      cnt = max(cnt - 1, 0LL);
      ans[i] = last++;
      i++;
      continue;
    }
    last++;
    m -= (1LL << cnt);
    cnt = max(cnt - 1, 0LL);
  }
  for (long long j = 1; j < i; j++) used[ans[j]] = true;
  for (long long j = i; j <= n; j++) {
    for (long long k = n; k >= 1; k--)
      if (!used[k]) {
        ans[j] = k;
        used[k] = true;
        break;
      }
  }
  for (long long i = 1; i <= n; i++) printf("%I64d ", ans[i]);
  printf("\n");
  return 0;
}
