#include <bits/stdc++.h>
using namespace std;
int a[1000], c, n, m, v[1000], j, i;
bool f[1000];
void rec(int x) {
  a[c++] = x;
  f[x] = true;
  if (x == n) return;
  for (int j = x + 1; j <= n; j++)
    if (m <= v[j]) {
      rec(j);
      return;
    } else
      m -= v[j];
}
int main() {
  cin >> n >> m;
  v[n] = 1;
  for (j = n - 1; j >= 0; j--) {
    for (i = j + 1; i <= n; i++) v[j] += v[i];
  }
  rec(0);
  for (j = n; j >= 0; j--)
    if (!f[j]) a[c++] = j;
  for (j = 1; j <= n; j++) cout << a[j] << " ";
  cout << endl;
}
