#include <bits/stdc++.h>
using namespace std;
long long a[60];
int main() {
  long long n, t, i, j, m;
  cin >> n >> m;
  long long tot = 1;
  for (i = 1; i <= n - 1; i++) tot *= 2;
  i = 1;
  int left = 1, right = n;
  while (left <= right) {
    if (m <= tot / 2) {
      a[left] = i;
      left++;
      tot /= 2;
    } else {
      a[right] = i;
      right--;
      m = m - (tot / 2);
      tot /= 2;
    }
    i++;
  }
  for (i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
}
