#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<vector<int> > > arr(1e6);
  vector<int> d(n), D(n);
  for (int i = 0; i < n; i++) d[i] = i + 1;
  D = d;
  int mx = 0;
  int cur = 0;
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      cur += *min_element(d.begin() + i, d.begin() + j + 1);
    }
  arr[cur].push_back(d);
  mx = max(mx, cur);
  next_permutation(d.begin(), d.end());
  while (d != D) {
    cur = 0;
    for (int i = 0; i < n; i++)
      for (int j = i; j < n; j++) {
        cur += *min_element(d.begin() + i, d.begin() + j + 1);
      }
    arr[cur].push_back(d);
    mx = max(mx, cur);
    next_permutation(d.begin(), d.end());
  }
  m--;
  for (int i = 0; i < arr[mx][m].size(); i++) cout << arr[mx][m][i] << " ";
  return 0;
}
