#include <bits/stdc++.h>
using namespace std;
static const int C = 1000000007;
static const int m = 111111;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, i, m, l, r, arr[100];
  cin >> n >> m;
  m--;
  l = 0;
  r = n - 1;
  for (i = n - 1; i >= 0; i--) {
    if ((m >> (i - 1)) % 2) {
      arr[r] = n - i;
      r--;
    } else {
      arr[l] = n - i;
      l++;
    }
  }
  for (i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  return 0;
}
