#include <bits/stdc++.h>
using namespace std;
int B[10], n;
int A[100000][10];
int countmm = 0;
int CCC[10] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
void permutation(int index) {
  int i, j, k, a, b, c;
  if (index == n) {
    for (i = 0; i < n; i++) {
      A[countmm][i] = B[i];
    }
    countmm++;
    return;
  }
  for (i = 1; i <= n; i++) {
    if (CCC[i] != 0) {
      B[index] = i;
      CCC[i] = 0;
      permutation(index + 1);
      CCC[i] = 1;
    }
  }
}
int maxperm(int counter) {
  int min, val, i, j, a, b, c, k, sum = 0;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      min = 1000;
      for (k = i; k <= j; k++) {
        val = A[counter][k];
        if (val < min) min = val;
      }
      sum += min;
    }
  }
  return sum;
}
int main() {
  int m, a, b, c, i, j, k, counter = 0, vish = 0;
  int AA[100000];
  int BB[100000];
  cin >> n >> m;
  permutation(0);
  int maxer = 0;
  for (i = 0; i <= 40320; i++) {
    k = maxperm(i);
    if (k > maxer) maxer = k;
  }
  for (i = 0; i <= 40320; i++) {
    k = maxperm(i);
    if (k == maxer) vish++;
    if (vish == m) {
      for (j = 0; j < n; j++) {
        cout << A[i][j] << " ";
      }
      cout << endl;
      return 0;
    }
  }
  return 0;
}
