#include <bits/stdc++.h>
using namespace std;
int p[100];
int main() {
  int n;
  long long m;
  cin >> n >> m;
  int pos1 = 1, pos2 = n;
  for (int i = 1; i <= n - 1; i++) {
    if (m > (1ll << n - i - 1)) {
      p[pos2--] = i;
      m -= 1ll << n - i - 1;
    } else {
      p[pos1++] = i;
    }
  }
  p[pos1] = n;
  for (int i = 1; i <= n; i++) cout << p[i] << ' ';
}
