#include <bits/stdc++.h>
using namespace std;
int f(vector<int> p) {
  int sum = 0;
  for (int i = 0; i < p.size(); i++) {
    for (int j = i; j < p.size(); j++) {
      int min = 100;
      for (int k = i; k <= j; k++) {
        if (p[k] < min) {
          min = p[k];
        }
      }
      sum += min;
    }
  }
  return sum;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  unordered_map<int, vector<vector<int> > > values;
  int max = -1;
  for (int i = 1; i <= n; i++) {
    v.push_back(i);
  }
  int factorial = 1;
  for (int i = n; i > 0; i--) {
    factorial *= i;
  }
  for (int i = 0; i < factorial; i++) {
    int val = f(v);
    if (val > max) {
      max = val;
    }
    if (val >= max) {
      values[val].push_back(v);
    }
    next_permutation(v.begin(), v.end());
  }
  for (int i = 0; i < n; i++) {
    cout << values[max][m - 1][i] << " ";
  }
  cout << endl;
  return 0;
}
