#include <bits/stdc++.h>
using namespace std;
const int base = 1000100000;
const int base_digits = 9;
long long power(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b % 2 == 1) ret = (ret * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  if (ret == 0) ret = 1000000007;
  return ret;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int ans[51];
long long fac(int n) {
  if (n == 0) return 1;
  return (long long)(n)*fac(n - 1);
}
int main() {
  int n;
  long long permnumber;
  cin >> n >> permnumber;
  if (n == 1) {
    printf("1");
    return 0;
  }
  if (n == 2) {
    if (permnumber == 1)
      printf("1 2\n");
    else
      printf("2 1\n");
    return 0;
  }
  if (n == 3) {
    if (permnumber == 1)
      printf("1 2 3\n");
    else if (permnumber == 2)
      printf("1 3 2\n");
    else if (permnumber == 3)
      printf("2 3 1\n");
    else
      printf("3 2 1\n");
    return 0;
  }
  long long possible = ((long long)1 << (n - 1));
  bool visited[51];
  memset(visited, 0, sizeof(visited));
  int lastinserted = 0, j;
  for (int i = 1; i <= n; i++) {
    long long left = possible;
    long long adder = 0;
    for (j = lastinserted + 1; j <= n; j++) {
      if (visited[j] == 1) continue;
      adder = adder + (left / 2);
      if (adder >= permnumber) {
        lastinserted = j;
        cout << j << " ";
        permnumber -= (adder - (left / 2));
        visited[j] = 1;
        left -= (left / 2);
        break;
      }
      left -= (left / 2);
    }
    if (j == n + 1) break;
    possible = left;
  }
  for (int i = n; i >= 1; i--) {
    if (visited[i] == 0) cout << i << " ";
  }
  return 0;
}
