#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  memset(a, 0, n * sizeof(int));
  int max_sum = 0;
  for (int i = 0; i < n; i++) {
    a[i] = i + 1;
    max_sum += a[i] * (n - i);
  }
  int k = 1;
  while (k != m) {
    next_permutation(a, a + n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
      int min_el = 10000;
      for (int j = i; j < n; j++) {
        for (int z = i; z <= j; z++) min_el = min(min_el, a[z]);
        sum += min_el;
      }
    }
    if (sum == max_sum) k++;
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
