#include <bits/stdc++.h>
using namespace std;
long long nums[50], k, n;
int main() {
  cin >> n >> k;
  int l = 0, r = n - 1;
  for (int i = 0; i < n; i++) {
    if ((k - 1) & (1ll << (n - i - 1 - 1))) {
      nums[r--] = i + 1;
    } else {
      nums[l++] = i + 1;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << nums[i] << " ";
  }
  cout << "\n";
}
