#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    vector<int> t;
    for (int i = 1; i <= n; i++) t.push_back(i);
    vector<vector<int> > res;
    int mx = 0;
    do {
      int tmp = 0;
      for (int i = 0; i < t.size(); i++) {
        int k = t[i];
        for (int j = i; j < t.size(); j++) {
          k = min(k, t[j]);
          tmp += k;
        }
      }
      if (tmp > mx) {
        res.clear();
        res.push_back(t);
        mx = tmp;
      } else if (tmp == mx)
        res.push_back(t);
    } while (next_permutation(t.begin(), t.end()));
    for (int i = 0; i < res[m - 1].size(); i++) printf("%d ", res[m - 1][i]);
    ;
    printf("\n");
  }
  return 0;
}
