#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<bool> p;
string s;
string t;
string solve(int k) {
  if (k == n) return t + char(n + '0');
  if (p[k - 1] == 1)
    return solve(k + 1) + char('0' + k);
  else
    return (char(k + '0') + solve(k + 1));
}
int main() {
  cin >> n >> m;
  m--;
  while (m) {
    p.push_back(m % 2);
    m /= 2;
  }
  int u = p.size();
  for (int i = u + 1; i < n; i++) p.push_back(0);
  reverse(p.begin(), p.end());
  s = solve(1);
  for (int i = 0; i < n; i++) cout << s[i] << " ";
  return 0;
}
