#include <bits/stdc++.h>
using namespace std;
int sum[4 * 100005], a[100005];
void build(int i, int l, int r) {
  if (l == r) {
    sum[i] = a[l];
  } else {
    int m = (l + r) / 2;
    build(2 * i, l, m);
    build((2 * i) + 1, m + 1, r);
    sum[i] = sum[2 * i] + sum[(2 * i) + 1];
  }
}
int query(int ind, int i, int j, int l, int r) {
  if (l > r) {
    return 1e9;
  }
  if (i == l && j == r) {
    return sum[ind];
  }
  int mid = (i + j) / 2;
  int k1 = query(ind * 2, i, mid, l, min(r, mid)),
      k2 = query((ind * 2) + 1, mid + 1, j, max(l, mid + 1), r);
  int ret = k1 + k2;
  return ret;
}
void update(int ind, int l, int r, int i, int val) {
  if (l == r) {
    sum[ind] = val;
  }
  int m = (l + r) / 2;
  if (i <= m) {
    update(2 * ind, l, m, i, val);
  } else {
    update((2 * ind) + 1, m + 1, r, i, val);
  }
  sum[ind] = sum[ind * 2] + sum[(ind * 2) + 1];
}
long long int poo(long long int a, int b) {
  long long int ans = 1LL;
  while (b) {
    if (b & 1) ans = (ans * a);
    a = (a * a);
    b /= 2;
  }
  return ans;
}
int main() {
  int t, m, n, i, j, k, l;
  t = 1;
  while (t--) {
    long long m;
    cin >> n >> m;
    if (n == 2 && m == 2) {
      cout << "2 1\n";
      return 0;
    }
    int a[n + 1];
    memset(a, 0, sizeof(a));
    int st, en;
    st = 1;
    en = n;
    for (i = 1; i <= n; i++) {
      long long x = poo(2, n - i - 1);
      if (m > x) {
        m -= x;
        a[en] = i;
        en--;
      } else {
        a[st] = i;
        st++;
      }
    }
    for (i = 1; i <= n; i++) cout << a[i] << " ";
  }
  return 0;
}
