#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > all;
map<int, vector<vector<int> > > mm;
int cnt(vector<int> &vc) {
  int val = 100;
  int sum = 0;
  for (int i = 0; i < vc.size(); ++i) {
    for (int j = i; j < vc.size(); ++j) {
      val = 100;
      for (int k = i; k <= j; ++k) val = min(val, vc[k]);
      sum += val;
    }
  }
  return sum;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> vc(n);
  for (int i = 1; i <= n; ++i) vc[i - 1] = i;
  do {
    mm[-cnt(vc)].push_back(vc);
  } while (next_permutation(vc.begin(), vc.end()));
  all = mm.begin()->second;
  sort(all.begin(), all.end());
  for (int i = 0; i < n; ++i) cout << all[m - 1][i] << " ";
  cout << endl;
  return 0;
}
