#include <bits/stdc++.h>
int main() {
  static int aa[50];
  int n, i, j, k;
  long long m;
  scanf("%d%lld", &n, &m);
  m--;
  for (i = 1, j = 0, k = n - 1; i < n; i++)
    if ((m & 1LL << (n - 1 - i)) == 0)
      aa[j++] = i;
    else
      aa[k--] = i;
  for (i = 0; i < n; i++) printf("%d ", aa[i] == 0 ? n : aa[i]);
  printf("\n");
  return 0;
}
