#include <bits/stdc++.h>
using namespace std;
long long dp[55];
int main() {
  int n;
  long long have;
  cin >> n >> have;
  dp[n] = 1;
  for (int i = n - 1; i > 0; --i) {
    for (int j = i + 1; j <= n; ++j) {
      dp[i] += dp[j];
    }
  }
  vector<int> x, y;
  for (int i = 1; i <= n; ++i) {
    if (have <= dp[i]) {
      x.push_back(i);
    } else {
      y.push_back(i);
      have -= dp[i];
    }
  }
  for (__typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++) {
    cout << *itr << " ";
  }
  for (int i = y.size() - 1; i >= 0; --i) {
    cout << y[i] << " ";
  }
  cout << endl;
  return 0;
}
