#include <bits/stdc++.h>
using namespace std;
int n, m;
int ara[101], ara1[100001][11];
int fun() {
  int ret = 0;
  int i, j;
  for (i = 0; i < n; i++) {
    int Min = ara[i];
    for (j = i; j < n; j++) {
      Min = min(Min, ara[j]);
      ret += Min;
    }
  }
  return ret;
}
int main() {
  int a, b, c, i, j, k, tc, t, cnt = 0;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) ara[i] = i + 1;
  a = fun();
  for (i = 0; i < n; i++) ara1[0][i] = ara[i];
  int Max = a;
  cnt = 1;
  while (next_permutation(ara, ara + n)) {
    a = fun();
    if (a == Max) {
      for (i = 0; i < n; i++) ara1[cnt][i] = ara[i];
      cnt++;
    }
  }
  for (i = 0; i < n; i++) printf("%d ", ara1[m - 1][i]);
  printf("\n");
  return 0;
}
