#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int M = 1e9;
const int inf = 7340033;
const long long base = 1e18;
const double pi = acos(-1);
const double ep = 1e-9;
int a[N];
long long lt[52];
int k;
void res(int n, long long m, int l, int r) {
  if (n == 1) {
    a[l] = k;
    return;
  }
  long long tmp = lt[n - 2];
  if (m > tmp) {
    a[r] = k - n + 1;
    res(n - 1, m - tmp, l, r - 1);
  } else {
    a[l] = k - n + 1;
    res(n - 1, m, l + 1, r);
  }
}
int main() {
  lt[0] = 1;
  long long n, m;
  cin >> n >> m;
  k = n;
  for (int i = (int)1; i < (int)k + 1; i++) lt[i] = (lt[i - 1] * 2);
  res(n, m, 1, n);
  for (int i = (int)1; i < (int)n + 1; i++) cout << a[i] << " ";
}
