#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int p[100];
int f() {
  int r = 0;
  for (int i = 0; i < n; i++) {
    int m = p[i];
    for (int j = i; j < n; j++) {
      if (m > p[j]) m = p[j];
      r += m;
    }
  }
  return r;
}
void print() {
  for (int i = 0; i < n; i++) {
    cout << p[i] << ' ';
  }
  cout << endl;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 99; i >= 0; i--) {
    p[i] = i + 1;
  }
  int ma = f();
  iota(p, p + 100, 1);
  int i = 0;
  do {
    if (f() == ma) {
      i++;
      if (i == m) {
        print();
        break;
      }
    }
  } while (next_permutation(p, p + n));
  return 0;
}
