#include <bits/stdc++.h>
using namespace std;
int v[10];
int ans[100];
void solve(int e, int a, int b, long long perm) {
  if (a > b) return;
  long long has = (b - a) + 1;
  has = (1LL << (has - 2LL));
  if (perm <= has) {
    ans[a] = e;
    solve(e + 1, a + 1, b, perm);
  } else {
    ans[b] = e;
    solve(e + 1, a, b - 1, perm - has);
  }
}
int main() {
  int n;
  scanf(" %d", &n);
  long long k;
  scanf(" %lld", &k);
  solve(1, 0, n - 1, k);
  for (int i = 0; i < (n); ++i) {
    if (i) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
