#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
long long n, m, a[51];
void reads() { cin >> n >> m; }
void process() {
  long long i = 1, j = n, cnt = n, tmp = 0;
  while (cnt != 0) {
    if (m <= (1LL << (cnt - 2))) {
      a[i++] = ++tmp;
    } else {
      a[j--] = ++tmp;
      m -= 1LL << (cnt - 2);
    }
    cnt--;
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
void result() {}
int main() {
  reads();
  process();
  result();
}
