#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, m;
int f() {
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int a = 10;
    for (int j = i; j < n; j++) {
      for (int k = i; k <= j; k++) a = min(a, v[k]);
      ans += a;
    }
  }
  return ans;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    v.push_back(i);
  }
  sort(v.begin(), v.end());
  int maxx = 0;
  do {
    maxx = max(maxx, f());
  } while (next_permutation(v.begin(), v.end()));
  int k = 0;
  sort(v.begin(), v.end());
  int c = 0;
  do {
    if (f() == maxx) c++;
    if (c == m) {
      for (auto i : v) cout << i << " ";
      break;
    }
  } while (next_permutation(v.begin(), v.end()));
  cout << endl;
  return 0;
}
