#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
const double pi = acos(-1.0);
const int size = 100;
vector<int> segs;
int f(vector<int> p) {
  int n = p.size();
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int cur = p[i];
    for (int j = i; j < n; j++) {
      cur = min(cur, p[j]);
      sum += cur;
    }
  }
  return sum;
}
int ans[size];
int main() {
  int n;
  long long m;
  cin >> n >> m;
  long long pw = 1;
  for (int i = 1; i < n; i++) pw *= 2;
  int lb = 0;
  int rb = n - 1;
  for (int i = 1; i <= n; i++) {
    pw /= 2;
    if (m <= pw) {
      ans[lb++] = i;
    } else {
      m -= pw;
      ans[rb--] = i;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
