#include <bits/stdc++.h>
using namespace std;
int n, m;
int maxp(vector<int> v) {
  int res = 0, mn;
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      mn = 100000000;
      for (int k = i; k <= j; k++) mn = min(mn, v[k]);
      res += mn;
    }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  vector<int> v(n);
  for (int i = 1; i <= n; i++) v[i - 1] = i;
  int mx = 0;
  do {
    mx = max(mx, maxp(v));
  } while (next_permutation(v.begin(), v.end()));
  vector<vector<int> > grid;
  for (int i = 1; i <= n; i++) v[i - 1] = i;
  do {
    if (maxp(v) == mx) grid.push_back(v);
  } while (next_permutation(v.begin(), v.end()));
  sort(grid.begin(), grid.end());
  for (int i = 0; i < n; i++) cout << grid[m - 1][i] << " ";
  return 0;
}
