#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int n, m;
  cin >> n >> m;
  int maks = 0;
  for (int i = 0; i < n; i++) v.push_back(i + 1);
  do {
    int res = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int x = 100;
        for (int k = i; k <= j; k++) x = min(x, v[k]);
        res += x;
      }
    }
    maks = max(res, maks);
  } while (next_permutation(v.begin(), v.end()));
  v.clear();
  for (int i = 0; i < n; i++) v.push_back(i + 1);
  do {
    int res = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int x = 100;
        for (int k = i; k <= j; k++) x = min(x, v[k]);
        res += x;
      }
    }
    if (res == maks) {
      m--;
      if (m > 0) continue;
      for (int i = 0; i < n; i++) cout << v[i] << " ";
      cout << "\n";
      break;
    }
  } while (next_permutation(v.begin(), v.end()));
}
