#include <bits/stdc++.h>
using namespace std;
int calc(vector<int> &v) {
  int n = v.size();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      int x = 1e9;
      for (int k = i; k <= j; ++k) {
        x = min(x, v[k]);
      }
      ans += x;
    }
  }
  return ans;
}
void naive(int n, int k) {
  vector<int> v(n);
  iota(v.begin(), v.end(), 1);
  vector<vector<int>> res;
  int mx = 0;
  do {
    int ret = calc(v);
    if (mx < ret) res.clear(), mx = ret;
    if (mx == ret) res.push_back(v);
  } while (next_permutation(v.begin(), v.end()));
  auto ans = res[k - 1];
  for (int i = (0); i < (int)(n); ++i) cout << ans[i] << " \n"[i == n - 1];
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, k;
  while (cin >> n >> k) {
    naive(n, k);
  }
}
