#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, m2, l = 0, r, i;
  cin >> n >> m;
  m--;
  r = n;
  vector<long long> res(n);
  for (m2 = (long long)(1) << (n - 2), i = 1; m2 > 0; m2 >>= 1, i++) {
    if (m2 & m)
      res[--r] = i;
    else
      res[l++] = i;
  }
  res[l] = i;
  for (i = 0; i < n; i++) cout << res[i] << ' ';
  return 0;
}
