#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, left, right, p[52];
  vector<long long> bin;
  cin >> n >> m;
  m--;
  while (m) {
    if (m & 1)
      bin.push_back(1);
    else
      bin.push_back(0);
    m /= 2;
  }
  for (i = bin.size(); i < n - 1; i++) bin.push_back(0);
  reverse(bin.begin(), bin.end());
  left = 0;
  right = n - 1;
  for (i = 0; i < n - 1; i++) {
    if (bin[i]) {
      p[right] = i + 1;
      right--;
    } else {
      p[left] = i + 1;
      left++;
    }
  }
  p[left] = i + 1;
  for (i = 0; i < n - 1; i++) cout << p[i] << " ";
  cout << p[i] << endl;
  return 0;
}
