#include <bits/stdc++.h>
using namespace std;
int perm[55];
int main() {
  int n;
  long long m;
  scanf("%d%lld", &n, &m);
  m--;
  int l = 1;
  int r = n;
  for (long long i = n - 2; i >= 0; i--) {
    if (m & (1LL << i)) {
      perm[r] = n - 2 - i + 1;
      r--;
    } else {
      perm[l] = n - 2 - i + 1;
      l++;
    }
  }
  perm[l] = n;
  for (int i = 1; i <= n; i++) {
    printf("%d ", perm[i]);
  }
  return 0;
}
