#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100];
int main() {
  ll n, m;
  cin >> n >> m;
  int st = 0, ed = n - 1;
  for (ll i = 1; i < n; ++i) {
    ll p2 = 1ll << (n - i - 1);
    if (m <= p2)
      a[st++] = i;
    else
      a[ed--] = i, m -= p2;
  }
  a[st] = n;
  for (int i = 0; i < n; ++i) cout << a[i] << " ";
  return 0;
}
