#include <bits/stdc++.h>
using namespace std;
int ls[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int main() {
  int i, j, o;
  int n, m, gmn = 0;
  scanf("%d %d", &n, &m);
  do {
    int ct = 0;
    for (i = 0; i < n; i++)
      for (j = i; j < n; j++) {
        int mn = 10;
        for (o = i; o <= j; o++) mn = min(mn, ls[o]);
        ct += mn;
      }
    gmn = max(ct, gmn);
  } while (next_permutation(ls, ls + n));
  sort(ls, ls + n);
  do {
    int ct = 0;
    for (i = 0; i < n; i++)
      for (j = i; j < n; j++) {
        int mn = 10;
        for (o = i; o <= j; o++) mn = min(mn, ls[o]);
        ct += mn;
      }
    if (gmn == ct) {
      m--;
      if (m == 0) {
        for (i = 0; i < n; i++) printf("%d ", ls[i]);
        printf("\n");
        break;
      }
    }
  } while (next_permutation(ls, ls + n));
  return 0;
}
