#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
long long n, m;
int sol[MAXN];
void solve(int l, int r, long long k) {
  if (l == r) {
    assert(k == 1);
    sol[l] = n;
    return;
  }
  int len = r - l + 1;
  long long cant = (1LL << (len - 1));
  if (k <= cant / 2) {
    sol[l] = n - len + 1;
    solve(l + 1, r, k);
  } else {
    sol[r] = n - len + 1;
    solve(l, r - 1, k - cant / 2);
  }
}
int main() {
  cin >> n >> m;
  solve(0, n - 1, m);
  for (int i = 0; i < n; i++) cout << sol[i] << " \n"[i == n - 1];
}
