#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
void dfs(int i, long long m, deque<int> &a) {
  if (i == n) {
    a.push_back(i);
  } else {
    long long k = 1LL << (n - i - 1);
    if (m <= k) {
      dfs(i + 1, m, a);
      a.push_front(i);
    } else {
      dfs(i + 1, m - k, a);
      a.push_back(i);
    }
  }
}
int main() {
  cin >> n >> m;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  deque<int> a;
  dfs(1, m, a);
  for (int i = 0; i < n; i++) {
    cout << a[i] << " \n"[i == n - 1];
  }
}
