#include <bits/stdc++.h>
using namespace std;
int v[55], res[55];
int n;
long long m;
int f() {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int t = v[i];
    for (int j = i; j < n; j++) {
      t = min(t, v[j]);
      sum += t;
    }
  }
  return sum;
}
int main() {
  cin >> n >> m;
  long long a = m;
  for (int i = 0; i < n; i++) v[i] = i + 1;
  long long tot = 1LL << (n - 1);
  int l = 0, r = n - 1;
  int k = 1;
  for (int i = 0; i < n; i++) {
    if (m > tot / 2) {
      res[r--] = k++;
      m -= tot / 2;
    } else {
      res[l++] = k++;
    }
    tot /= 2;
  }
  m = a;
  for (int i = 0; i < n; i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
