#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[1005];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m;
  long long l = 0, r = n - 1;
  for (int i = n - 1; i > 0; i--) {
    if (m <= pow(2, i - 1)) {
      a[l++] = n - i;
    } else {
      a[r--] = n - i;
      m -= pow(2, i - 1);
    }
  }
  a[l] = n;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
