#include <bits/stdc++.h>
using namespace std;
signed main() {
  cout << fixed << setprecision(15);
  long long n, m;
  cin >> n >> m;
  m--;
  deque<long long> ans;
  ans.push_back(n);
  long long t = n - 1;
  while (t--) {
    if (m & 1)
      ans.push_back(t + 1);
    else
      ans.push_front(t + 1);
    m = m / 2;
  }
  for (auto it : ans) {
    cout << it << " ";
  }
  return 0;
}
