#include <bits/stdc++.h>
using namespace std;
long long n, m;
bool def() {
  long long d = 1;
  for (int i = 0; i < n - 1; ++i) d *= 2;
  if (m == 0) return false;
  if (m <= d) {
    --n;
    return true;
  } else {
    m -= d;
    --n;
    return false;
  }
}
int main() {
  cin >> n >> m;
  int y = n;
  --n;
  vector<long long> ans;
  vector<bool> used(y, false);
  for (long long i = 0; i < y; ++i)
    if (def()) {
      ans.push_back(i + 1);
      used[i] = true;
    }
  for (int i = y - 1; i >= 0; --i)
    if (!used[i]) ans.push_back(i + 1);
  for (int i = 0; i < y; ++i) cout << ans[i] << " ";
  return 0;
}
