#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000,100000000000")
using namespace std;
const double eps = 1E-9;
const double Exp = 2.718281828459045;
const double Pi = 3.1415926535897932;
const int NMAX = 50 + 5;
const int MMAX = 100000 + 5;
const int INF = 1000000000;
const int BS = 1000000007;
template <typename T>
inline T abs(const T a) {
  if (a < 0) return -a;
  return a;
}
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
int main() {
  ios::sync_with_stdio(false);
  long long m;
  long long cnt[NMAX] = {0};
  int n;
  int i;
  long long j;
  int a[NMAX];
  int l, r;
  cin >> n >> m;
  l = 1;
  r = n;
  i = 1;
  for (j = (1ll << (n - 2)); j > 0; j >>= 1) {
    if (m > j) {
      m -= j;
      a[r--] = i++;
    } else {
      a[l++] = i++;
    }
  }
  a[l] = i;
  for (i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
