#include <bits/stdc++.h>
using namespace std;
int foo(const vector<int>& perm) {
  int res = 0;
  for (int i = 0; i < perm.size(); ++i)
    for (int j = i; j < perm.size(); ++j)
      res += *min_element(perm.begin() + i, perm.begin() + j + 1);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int64_t n, m;
  cin >> n >> m;
  m--;
  int64_t one = 1;
  int64_t totalAns = one << (n - 1);
  vector<int> ans(n);
  auto l = ans.begin();
  auto r = ans.end() - 1;
  int filled = 0;
  while (filled < n) {
    if (m < totalAns / 2) {
      filled++;
      totalAns /= 2;
      *l = filled;
      l++;
    } else {
      filled++;
      totalAns /= 2;
      m -= totalAns;
      *r = filled;
      r--;
    }
  }
  for (auto elt : ans) cout << elt << ' ';
  return 0;
}
