#include <bits/stdc++.h>
using namespace std;
int ans[10000];
int l, loc;
void work(int n, long long m) {
  if (n == 1) {
    ans[l++] = 1;
    loc = l - 1;
    return;
  }
  if (m % 2 == 0) {
    work(n - 1, m / 2);
    for (int i = l - 1; i >= loc + 1; i--) ans[i + 1] = ans[i];
    l++;
    ans[loc + 1] = n;
    loc = loc + 1;
  } else {
    work(n - 1, m / 2);
    for (int i = l - 1; i >= loc; i--) ans[i + 1] = ans[i];
    l++;
    ans[loc] = n;
  }
}
int main() {
  int n;
  long long m;
  l = 0;
  scanf("%d%I64d", &n, &m);
  work(n, m - 1);
  for (int i = 0; i < l - 1; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[l - 1]);
}
