#include <bits/stdc++.h>
const double PI = 3.1415926535897932384626433832795;
template <typename T>
T sqr(T x) {
  return x * x;
}
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > ans;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = i + 1;
  long long masu = 0;
  do {
    long long su = 0;
    for (int i = 0; i < n; ++i) {
      int mi = a[i];
      for (int j = i; j < n; ++j) {
        mi = min(a[j], mi);
        su += mi;
      }
    }
    if (su > masu) {
      masu = su;
      ans.clear();
      ans.push_back(a);
    } else if (su == masu)
      ans.push_back(a);
  } while (next_permutation(a.begin(), a.end()));
  for (int i = 0; i < n; ++i) {
    cout << ans[m - 1][i] << " ";
  }
  cout << endl;
  return 0;
}
