#include <bits/stdc++.h>
using namespace std;
int ans[100];
int n;
void solve(int num, int l, int r, long long m) {
  if (l == r) {
    ans[l] = num;
    return;
  }
  if (l > r) return;
  if ((1LL << n - num - 1) <= m) {
    ans[r] = num;
    solve(num + 1, l, r - 1, m - ((1LL) << (n - num - 1)));
  } else {
    ans[l] = num;
    solve(num + 1, l + 1, r, m);
  }
}
long long m;
int main() {
  cin >> n >> m;
  m--;
  solve(1, 1, n, m);
  for (int i = 1; i < n; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
  return 0;
}
