#include <bits/stdc++.h>
using namespace std;
static const int N = 52;
static const int M = 1000000;
int n, a[N];
long long m;
int funk() {
  int p = 0;
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      int cm = a[i];
      for (int k = i + 1; k <= j; k++)
        if (a[k] < cm) cm = a[k];
      p += cm;
    }
  return p;
}
void print() {
  for (int i = 0; i < n; i++) printf("%i ", a[i]);
  printf("\n");
}
int used[N];
int f(int x) {
  int c = -1;
  for (int i = 1; i <= n; i++) {
    if (!used[i]) c++;
    if (c == x) {
      used[i] = 1;
      return i;
    }
  }
}
void solve() {
  int x = m;
  int ru = n;
  int ex = 1;
  int t = 1 << (ru - 1);
  for (int i = 0; i < n - 1; i++) {
    if (ru <= 1) break;
    int k = 1;
    int r = 1;
    while (x <= t - k) {
      k *= 2;
      r++;
    }
    printf("%i %i %i %i %i\n", x, ru, t, r, k);
    ex += ru - r;
    used[ex] = 1;
    if (r - 1 > 0) printf("%i\n", ex);
    x -= (t - k);
    ru = r - 1;
    t = k / 2;
  }
  for (int i = n; i >= 1; i--)
    if (!used[i]) printf("%i\n", i);
}
void solve2(int n, int m) {
  int x = m;
  int ru = n;
  int t = 1 << (ru - 1);
  int k = 1;
  int r = 1;
  while (x <= t - k) {
    k *= 2;
    r++;
  }
  printf("%i %i %i %i %i\n", x, ru, t, r, k);
  printf("%i\n", f(ru - r));
  if (n - 1) solve2(n - 1, m - (t - k));
}
int res[N];
void solve3() {
  long long x = m - 1;
  long long first = 0;
  long long last = 1LL << (n - 1);
  last += 1;
  int p1 = 0;
  int p2 = n - 1;
  long long mid;
  for (int i = 1; i <= n; i++) {
    mid = (first + last) / 2;
    if (x < mid) {
      res[p1] = i;
      p1++;
      last = mid;
    } else {
      res[p2] = i;
      p2--;
      first = mid;
    }
  }
  printf("%i", res[0]);
  for (int i = 1; i < n; i++) printf(" %i", res[i]);
  printf("\n");
}
int main() {
  scanf("%i", &n);
  cin >> m;
  for (int i = 0; i < n; i++) a[i] = i + 1;
  solve3();
  return 0;
}
