#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long m;
  scanf("%i %lli", &n, &m);
  long long cmp = 1LL << (n - 2);
  int ans[n], i = 0, j = n - 1, v = 1;
  while (i != j) {
    if (m <= cmp) {
      ans[i++] = v++;
    } else {
      ans[j--] = v++;
      m -= cmp;
    }
    cmp >>= 1;
  }
  ans[i] = v;
  for (int i = 0; i < n; i++) printf("%i ", ans[i]);
}
