#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long powm(long long a, long long p, long long m) {
  long long r = 1 % m;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
int main() {
  int ans[50], n, mf = 1;
  long long m;
  cin >> n >> m;
  for (int l = 0, r = n - 1, i = n - 2; i >= -1; --i) {
    if (i == -1 || m <= (1ll << i))
      ans[l++] = mf++;
    else {
      ans[r--] = mf++;
      m -= 1ll << i;
    }
  }
  for (int i = 0; i < (n); ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}
