#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  string s = "";
  for (int i = 1; i <= a; i++) s = s + char('0' + i);
  string q;
  int k = 0;
  vector<pair<int, string> > v, c;
  do {
    int r = 0;
    for (int i = 0; i < a; i++) {
      for (int j = i; j < a; j++) {
        int minu = s[i] - '0';
        for (int w = i; w <= j; w++)
          if (s[w] - '0' <= minu) minu = s[w] - '0';
        r += minu;
      }
    }
    v.push_back(make_pair(r, s));
  } while (next_permutation(s.begin(), s.end()));
  sort(v.begin(), v.end());
  int z = v[v.size() - 1].first;
  for (int i = 0; i < v.size(); i++)
    if (v[i].first == z) c.push_back(v[i]);
  for (int i = 0; i < s.size(); i++) cout << c[b - 1].second[i] << " ";
  return 0;
}
