#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265359;
const long double eps = 1e-9;
template <typename T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <typename T>
T sqr(T x) {
  return x * x;
}
int a[111];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) a[i] = i;
  int istmin = -1;
  int k = 0;
  int p = 0;
  do {
    k++;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int mini = a[i];
      for (int j = i + 1; j < n; j++) {
        mini = min(mini, a[j]);
        ans += mini;
      }
    }
    if (k == 1) istmin = ans;
    if (ans == istmin) p++;
    if (p == m) {
      for (int i = 0; i < n; i++) cout << a[i] + 1 << " ";
      cout << "\n";
      return 0;
    }
  } while (next_permutation(a, a + n));
  return 0;
}
