#include <bits/stdc++.h>
using namespace std;
vector<long long> ans;
string s;
long long n, m, i;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  m--;
  while (m > 0) {
    if (m % 2 == 0)
      s += "L";
    else
      s += "R";
    m /= 2;
  }
  while (s.size() < n - 1) s += "L";
  for (i = n - 2; i >= 0; i--)
    if (s[i] == 'L') ans.push_back(s.size() - i);
  ans.push_back(n);
  for (i = 0; i < n - 1; i++)
    if (s[i] == 'R') ans.push_back(s.size() - i);
  for (i = 0; i < ans.size() - 1; i++) cout << ans[i] << " ";
  cout << ans[ans.size() - 1] << '\n';
  return 0;
}
