#include <bits/stdc++.h>
using namespace std;
int perval(vector<int>& v, int n) {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int mi = INT_MAX;
      for (int k = i; k < j + 1; k++) {
        mi = min(mi, v[k]);
      }
      sum += mi;
    }
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> v;
  vector<vector<int>> vp;
  for (int i = 0; i < n; i++) {
    v.push_back(i + 1);
  }
  int ma = INT_MIN;
  do {
    ma = max(ma, perval(v, n));
  } while (next_permutation(v.begin(), v.end()));
  sort(v.begin(), v.end());
  do {
    if (perval(v, n) == ma) {
      vp.resize(vp.size() + 1);
      vp[vp.size() - 1].insert(vp[vp.size() - 1].begin(), v.begin(), v.end());
    }
  } while (next_permutation(v.begin(), v.end()));
  for (vector<int>::iterator it = vp[m - 1].begin(); it != vp[m - 1].end();
       it++) {
    cout << *it << " ";
  }
  cout << endl;
  return 0;
}
