#include <bits/stdc++.h>
using namespace std;
const int N = int(3e6);
int n, a[55];
long long m, d[55];
int main() {
  cin >> n >> m;
  d[0] = 1;
  for (int i = 1; i <= n; i++) {
    d[i] = 2 * d[i - 1];
  }
  int i = 1, j = n, k = 1;
  while (k <= n) {
    if (m > d[n - k - 1]) {
      m -= d[n - k - 1];
      a[j] = k;
      j--;
    } else {
      a[i] = k;
      i++;
    }
    k++;
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
