#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
long long n, k;
long long P[55];
void cal() {
  long long i;
  P[0] = 1;
  for (i = 1; i <= 50; i++) {
    P[i] = P[i - 1] * 2;
  }
}
long long R[55];
int main() {
  long long i, j;
  cal();
  while (scanf("%I64d %I64d", &n, &k) != EOF) {
    long long cur, tot = P[n - 1];
    cur = tot;
    long long in = 1;
    long long rear = n;
    long long r = P[n - 1];
    for (i = 1; i <= n; i++) {
      r = r / 2;
      if (r >= k) {
        R[in] = i;
        in++;
      } else {
        k = k - r;
        R[rear] = i;
        rear--;
      }
    }
    for (i = 1; i <= n; i++) {
      if (i == 1)
        printf("%I64d", R[i]);
      else
        printf(" %I64d", R[i]);
    }
    printf("\n");
  }
  return 0;
}
