#include <bits/stdc++.h>
using namespace std;
int cal(int p[], int n) {
  int res = 0;
  for (int i = 0; i < n; ++i) {
    int tmp = n;
    for (int j = i; j < n; ++j) {
      tmp = min(tmp, p[j]);
      res += tmp;
    }
  }
  return res;
}
vector<pair<int, int> > vt;
int main() {
  int n, m, p[55];
  cin >> n >> m;
  for (int i = 0; i < n; ++i) p[i] = i + 1;
  int res = cal(p, n);
  int k = 0;
  do {
    int ans = cal(p, n);
    if (ans != res) continue;
    k++;
    if (k == m) break;
  } while (next_permutation(p, p + n));
  for (int i = 0; i < n; ++i) printf("%d ", p[i]);
  puts("");
  return 0;
}
