#include <bits/stdc++.h>
using namespace std;
const int max_n = 10;
int n, m, ary[max_n], f;
int find() {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      sum += *min_element(ary + i, ary + j + 1);
    }
  }
  return sum;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    ary[i] = i + 1;
    f += (i + 1) * (n - i);
  }
  m--;
  while (m) {
    next_permutation(ary, ary + n);
    if (f == find()) m--;
  }
  for (int i = 0; i < n; i++) cout << ary[i] << " ";
  cout << endl;
  return 0;
}
