#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  m--;
  deque<long long int> x;
  x.push_back(n);
  n--;
  while (m) {
    if ((m % 2)) {
      x.push_back(n);
    } else {
      x.push_front(n);
    }
    m /= 2;
    n--;
  }
  long long int i;
  for (i = 1; i <= n; i++) {
    cout << i << " ";
  }
  for (i = 0; i < x.size(); i++) {
    cout << x[i] << " ";
  }
  cout << endl;
  return 0;
}
