#include <bits/stdc++.h>
using namespace std;
int n;
int arr[9];
int f(vector<int> x) {
  int mn = 2e9;
  int last = 0;
  int out = 0;
  for (int i = 0; i < n; i++) {
    last = 0;
    mn = 2e9;
    for (int j = i; j < n; j++) {
      mn = min(mn, x[j]);
      last += mn;
    }
    out += last;
  }
  return out;
}
int main() {
  int m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) arr[i] = i + 1;
  vector<pair<int, vector<int> > > perm;
  do {
    vector<int> temp;
    for (int i = 0; i < n; i++) temp.push_back(arr[i]);
    int t = f(temp);
    perm.push_back({-t, temp});
  } while (next_permutation(arr, arr + n));
  sort(perm.begin(), perm.end());
  for (int i = 0; i < n; i++) cout << perm[m - 1].second[i] << " ";
  cout << endl;
  return 0;
}
