#include <bits/stdc++.h>
const int NUM = 100010;
const double eps = 1e-6, pi = acos(-1.0);
using namespace std;
long long n, m, k;
int ans[60], l, r;
int main() {
  int i, j;
  while (~scanf("%I64d%I64d", &n, &m)) {
    l = 1, r = n;
    k = n - 2;
    for (i = 1; i < n; i++, k--) {
      if (m > (1LL << k)) {
        m -= (1LL << k);
        ans[r--] = i;
      } else {
        ans[l++] = i;
      }
    }
    ans[l] = n;
    for (i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  }
  return 0;
}
