#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<vector<int> > sets;
  cin >> n >> m;
  vector<int> perm(n);
  for (int i = 1; i <= n; i++) {
    perm[i - 1] = i;
  }
  int max = 0;
  do {
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int minum = perm[i];
      for (int j = i; j < n; j++) {
        if (perm[j] < minum) minum = perm[j];
        sum += minum;
      }
    }
    if (sum == max) {
      sets.push_back(perm);
    } else if (sum > max) {
      max = sum;
      sets.clear();
      sets.push_back(perm);
    }
  } while (next_permutation(perm.begin(), perm.end()));
  for (int i = 0; i < n; i++) {
    cout << sets[m - 1][i] << " ";
  }
  cout << endl;
  return 0;
}
