#include <bits/stdc++.h>
using namespace std;
int n, a[55];
long long m;
int main() {
  cin >> n >> m;
  m--;
  int l = 0, r = n - 1;
  for (int i = 1; i <= n; i++) {
    if (m & (1ll << (n - 1 - i)))
      a[r--] = i;
    else
      a[l++] = i;
  }
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
}
