#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
int a[MAX];
int main() {
  ios::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  m--;
  m <<= 1;
  int cnt = 1, s = 0, e = n - 1;
  for (long long i = n - 1; i >= 0; i--)
    if ((1LL << i) & m)
      a[e--] = cnt++;
    else
      a[s++] = cnt++;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
