#include <bits/stdc++.h>
using namespace std;
vector<long long> MyPermutations;
vector<pair<long long, vector<long long> > > MaxAndPermu;
int main() {
  long long n, m;
  cin >> n >> m;
  int q, w, e, r;
  for (q = 1; q <= n; q++) MyPermutations.push_back(q);
  do {
    long long MAX = 0;
    for (long long i = 1; i <= n; i++) {
      for (long long j = i; j <= n; j++) {
        long long Min = INT_MAX;
        for (q = i - 1; q < j; q++) {
          if (MyPermutations[q] < Min) Min = MyPermutations[q];
        }
        MAX += Min;
      }
    }
    MaxAndPermu.push_back(make_pair(MAX, MyPermutations));
  } while (next_permutation(MyPermutations.begin(), MyPermutations.end()));
  sort(MaxAndPermu.begin(), MaxAndPermu.end());
  int y = 0;
  for (q = MaxAndPermu.size() - 1; q > 0; q--) {
    if (MaxAndPermu[q].first > MaxAndPermu[q - 1].first) {
      y = q;
      break;
    }
  }
  for (q = 0; q < n; q++)
    cout << MaxAndPermu[y + m - 1].second[q]
         << (q == (MaxAndPermu[y + m - 1].second.size() - 1) ? "\n" : " ");
  return 0;
}
