#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
int max_f;
int f(vector<int> &v) {
  int res = 0;
  for (int i = 0; i < v.size(); i++) {
    int temp = 1000000;
    for (int j = i; j < v.size(); j++) {
      temp = min(temp, v[j]);
      res += temp;
    }
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) v.push_back(i);
  do {
    max_f = max(max_f, f(v));
  } while (next_permutation(v.begin(), v.end()));
  do {
    if (f(v) == max_f) {
      m--;
      if (m == 0) {
        for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
        return 0;
      }
    }
  } while (next_permutation(v.begin(), v.end()));
  return 0;
}
