#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a[N];
long long m;
void work() {
  int i, j, k;
  cin >> n >> m;
  --m;
  int l = 0, r = n - 1;
  for (i = 1; i < n; ++i) {
    if ((~m >> (n - i - 1)) & 1)
      a[l++] = i;
    else
      a[r--] = i;
  }
  a[l++] = n;
  for (i = 0; i < n; ++i) printf("%d ", a[i]);
  puts("");
}
int main() {
  work();
  return 0;
}
