#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
int a[50];
int main() {
  cin >> n >> m;
  m--;
  int cur = 0;
  int i = 0, j = n - 1;
  for (int k = n - 2; k >= 0; k--) {
    if ((m >> k) & 1)
      a[j--] = cur++;
    else
      a[i++] = cur++;
  }
  a[i] = cur;
  for (int i = 0; i < n; i++) cout << a[i] + 1 << (i + 1 == n ? '\n' : ' ');
}
