#include <bits/stdc++.h>
using namespace std;
int n, s[55], l, r;
long long m, po;
int main() {
  scanf("%d %I64d", &n, &m);
  po = 1;
  for (int i = 1; i < n; i++) po *= 2;
  m--;
  l = 1, r = n;
  for (int i = 1; i < n; i++) {
    po /= 2;
    if (m >= po) {
      m -= po;
      s[r--] = i;
    } else
      s[l++] = i;
  }
  s[l] = n;
  for (int i = 1; i <= n; i++) printf("%d%c", s[i], i == n ? '\n' : ' ');
  return 0;
}
