#include <bits/stdc++.h>
using namespace std;
int n, m;
bool cmp(const vector<int> &a, const vector<int> &b) {
  for (int i = 0; i < n; i++)
    if (a[i] != b[i]) return a[i] < b[i];
  return false;
}
int main() {
  cin >> n >> m;
  vector<int> p(n);
  for (int i = 0; i < n; i++) p[i] = i;
  vector<vector<int>> ans;
  int mx = 0;
  do {
    int cur = 0;
    for (int i = 0; i < n; i++) {
      int mn = 100;
      for (int j = i; j < n; j++) {
        mn = min(p[j], mn);
        cur += mn;
      }
    }
    if (mx < cur) {
      mx = cur;
      ans.clear();
    }
    if (mx == cur) ans.push_back(p);
  } while (next_permutation(p.begin(), p.end()));
  sort(ans.begin(), ans.end(), cmp);
  m--;
  for (int i = 0; i < n; i++) cout << ans[m][i] + 1 << " ";
}
