#include <bits/stdc++.h>
using namespace std;
long long n, k;
void fn(int num, long long rem) {
  if (num > n) return;
  long long val = (1LL << (long long)(n - num - 1));
  if (rem >= val) {
    fn(num + 1, rem - val);
    cout << num << " ";
  } else {
    cout << num << " ";
    fn(num + 1, rem);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  k--;
  fn(1, k);
}
