#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
int main() {
  int n;
  long long m;
  scanf("%d %I64d", &n, &m);
  if (n == 1) {
    printf("1\n");
    return 0;
  }
  int a[110];
  long long all = (1LL << (n - 1));
  int fir = 1, end = n;
  for (int i = 1; i <= n; i++) {
    if (m > (all >> 1)) {
      a[end] = i;
      end--;
      m -= (all >> 1);
      all >>= 1;
      continue;
    }
    a[fir] = i;
    fir++;
    all >>= 1;
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
