#include <bits/stdc++.h>
using namespace std;
long long get(long long x) { return (1ll << (x - 1)); }
vector<long long> v, q;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    if (m > get(n - i)) {
      q.push_back(i);
      m -= get(n - i);
    } else
      v.push_back(i);
  }
  for (long long i = 0; i < v.size(); i++) cout << v[i] << " ";
  reverse(q.begin(), q.end());
  for (long long i = 0; i < q.size(); i++) cout << q[i] << " ";
}
