#include <bits/stdc++.h>
using namespace std;
int n;
int arr[60];
long long k;
int main() {
  cin >> n >> k;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  k--;
  int str = 0, end = n - 1;
  long long p = 1LL << (n - 2);
  for (int i = 1; i <= n; i++) {
    if (k >= p) {
      k -= p;
      arr[end--] = i;
    } else
      arr[str++] = i;
    p >>= 1;
  }
  for (int i = 0; i < n; i++) cout << arr[i] << ' ';
  cout << endl;
  return 0;
}
