#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> ans(n);
  for (int i = 0; i < n; i++) {
    ans[i] = i + 1;
  }
  vector<int> check;
  do {
    int sm = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int mn = INF;
        for (int y = i; y <= j; y++) {
          mn = min(mn, ans[y]);
        }
        sm += mn;
      }
    }
    check.push_back(sm);
  } while (next_permutation(ans.begin(), ans.end()));
  int mx = -1;
  for (int i = 0; i < check.size(); i++) {
    mx = max(mx, check[i]);
  }
  int now = 0, s = 0;
  for (int i = 0; i < check.size(); i++) {
    if (check[i] == mx) {
      now++;
      if (now == m) {
        break;
      }
    }
    next_permutation(ans.begin(), ans.end());
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
