#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;
long long func() {
  long long ret = 0;
  for (int i = 0; i <= n - 1; i++) {
    for (int j = 0; j <= n - 1; j++) {
      int mx = 50;
      for (int k = i; k <= j; k++) {
        mx = min(mx, v[k]);
      }
      ret += mx;
    }
  }
  return ret;
}
int main() {
  int m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    v.push_back(i);
  }
  long long ans = 0;
  do {
    ans = max(ans, func());
  } while (next_permutation(v.begin(), v.end()));
  sort(v.begin(), v.end());
  int cnt = 0;
  do {
    if (ans == func()) cnt++;
    if (cnt == m) break;
  } while (next_permutation(v.begin(), v.end()));
  for (int i = 1; i <= n; i++) {
    if (i - 1) cout << " ";
    cout << v[i - 1];
  }
  cout << endl;
  return 0;
}
