#include <bits/stdc++.h>
using namespace std;
long long n, m;
deque<long long> f, b;
int main() {
  cin >> n >> m;
  for (long long l = 1; l < n; l++) {
    if (m <= (1LL << (n - l - 1))) {
      f.push_back(l);
    } else {
      b.push_back(l);
      m -= (1LL << (n - l - 1));
    }
  }
  f.push_back(n);
  for (int i = 0; i < (int)f.size(); i++) cout << f[i] << " ";
  for (int j = (int)b.size() - 1; j >= 0; j--) cout << b[j] << " ";
  cout << endl;
}
