#include <bits/stdc++.h>
using namespace std;
vector<int> a;
map<long long, vector<vector<int> > > M;
int main() {
  int n;
  int m;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  for (int i = 1; i <= n; i++) {
    a.push_back(i);
  }
  do {
    long long curr = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        int res = n;
        for (int k = i; k <= j; k++) {
          res = min(res, a[k]);
        }
        curr += res;
      }
    }
    M[curr].push_back(a);
  } while (next_permutation(a.begin(), a.end()));
  map<long long, vector<vector<int> > >::iterator it;
  it = M.end();
  it--;
  vector<vector<int> > x = it->second;
  sort(x.begin(), x.end());
  a = x[m - 1];
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
