#include <bits/stdc++.h>
using namespace std;
int n, a[10], m;
int Va(int a[]) {
  int res = 0;
  for (int i = 1; i <= n; i++) {
    int mi = a[i];
    for (int j = i; j <= n; j++) {
      mi = min(mi, a[j]);
      res += mi;
    }
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) a[i] = i;
  int mx = 0;
  do {
    mx = max(mx, Va(a));
  } while (next_permutation(a + 1, a + n + 1));
  for (int i = 1; i <= n; i++) a[i] = i;
  do {
    if (Va(a) == mx) m--;
    if (m == 0) {
      for (int i = 1; i <= n; i++) cout << a[i] << " ";
      return 0;
    }
  } while (next_permutation(a + 1, a + n + 1));
}
