#include <bits/stdc++.h>
using namespace std;
std::vector<int> v, ans;
int p;
int main(int argc, char const *argv[]) {
  int n, m, ma;
  while (~scanf("%d%d", &n, &m)) {
    v.clear();
    ma = 0;
    for (int i = 1; i <= n; i++) v.push_back(i);
    int t = 1;
    for (int i = 1; i <= n; i++) t *= i;
    int cnt = 0, qq = 0;
    while (++qq <= t) {
      int mi, tmp = 0;
      for (int i = 1; i <= n; i++)
        for (int j = i; j <= n; j++) {
          mi = 60;
          for (int k = i; k <= j; k++) {
            mi = min(mi, v[k - 1]);
          }
          tmp += mi;
        }
      if (tmp >= ma) {
        ma = tmp;
        cnt++;
      }
      if (cnt == m) {
        ans = v;
        p = qq;
        break;
      }
      if (t) next_permutation(v.begin(), v.end());
    }
    for (int i = 1; i <= n; i++) printf("%d ", ans[i - 1]);
  }
  return 0;
}
