#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> v;
vector<long long> ans;
void arrange(long long start, long long end, long long pos) {
  if (start == end)
    ans[start] = pos + 1;
  else {
    if (v[pos] == 0) {
      ans[start] = pos + 1;
      arrange(start + 1, end, pos + 1);
    } else {
      ans[end] = pos + 1;
      arrange(start, end - 1, pos + 1);
    }
  }
}
int main() {
  cin >> n;
  cin >> m;
  v.resize(n);
  ans.resize(n);
  long long temp = m - 1;
  for (long long i = n - 2; i >= 0; i--) {
    v[i] = temp % 2;
    temp = temp / 2;
  }
  arrange(0, n - 1, 0);
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
