#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-6;
int ans[55];
int main() {
  int n;
  long long m;
  scanf("%d%I64d", &n, &m);
  m--;
  long long l = 0, r = (1LL << (long long)(n - 1)) - 1;
  int lp = 0, rp = n - 1;
  int cnt = 0;
  while (lp != rp) {
    long long mid = (l + r) / 2;
    if (m <= mid)
      ans[lp++] = ++cnt, r = mid;
    else
      ans[rp--] = ++cnt, l = mid;
  }
  ans[lp] = ++cnt;
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  return 0;
}
