#include <bits/stdc++.h>
using namespace std;
int n;
int v[10];
vector<int> fp;
int calc() {
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int t = v[i];
      for (int k = i + 1; k <= j; k++) t = min(t, v[k]);
      ans += t;
    }
  }
  return ans;
}
int main() {
  int m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) v[i] = i + 1;
  int maior = 0;
  do {
    int t = calc();
    fp.push_back(t);
    maior = max(t, maior);
  } while (next_permutation(v, v + n));
  int k = 0;
  int i = 0;
  do {
    if (fp[i] == maior) {
      k++;
      if (k == m) break;
    }
    i++;
  } while (next_permutation(v, v + n));
  for (int j = 0; j < n; j++) printf("%d ", v[j]);
  return 0;
}
