#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int calc(const vector<int>& p) {
  int ans = 0;
  for (int i = 0; i < p.size(); ++i) {
    int mi = 1e9;
    for (int j = i; j < p.size(); ++j) {
      mi = min(mi, p[j]);
      ans += mi;
    }
  }
  return ans;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p;
  for (int i = 1; i <= n; ++i) {
    p.push_back(i);
  }
  vector<vector<int> > perms;
  int best = -1;
  do {
    int cur = calc(p);
    if (cur > best) {
      perms.clear();
      perms.push_back(p);
      best = cur;
    } else {
      if (cur == best) {
        perms.push_back(p);
      }
    }
  } while (next_permutation(p.begin(), p.end()));
  sort(perms.begin(), perms.end());
  for (int i = 0; i < perms[m - 1].size(); ++i) {
    cout << perms[m - 1][i] << " ";
  }
  return 0;
}
