#include <bits/stdc++.h>
using namespace std;
void make(vector<pair<int, int> > &a, long long int b) {
  int last = 0;
  int n = a.size();
  for (int i = 0; i < a.size() - 1; i++) {
    if (b >= pow(2, n - 2 - i)) {
      a[i].first = n - last;
      last++;
      b = b - pow(2, n - 2 - i);
    } else {
      a[i].first = i + 1 - last;
    }
  }
  a[n - 1].first = n - last;
}
int main() {
  long long int n, b;
  cin >> n >> b;
  vector<pair<int, int> > a;
  for (int i = 0; i < n; i++) {
    a.push_back(make_pair(0, i + 1));
  }
  make(a, b - 1);
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) cout << a[i].second << " ";
}
