#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n;
  long long m;
  cin >> n >> m;
  m -= 1;
  vector<int> xs;
  for (int i = 0; i < n; i++) {
    xs.push_back(-1);
  }
  int i = 0;
  int u = 0;
  int v = n - 1;
  while (u <= v) {
    long long h = (1LL << (n - i - 2));
    if (m >= h) {
      xs[v] = i;
      v -= 1;
      m -= h;
    } else {
      xs[u] = i;
      u += 1;
    }
    i += 1;
  }
  for (int i = 0; i < n; i++) printf("%d ", xs[i] + 1);
  printf("\n");
  return 0;
}
