#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
char str[11];
int n;
int cal() {
  int i, j, k;
  int res = 0;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      int r = 987654321;
      for (k = i; k <= j; k++) {
        if (r > (str[k] - '0')) r = str[k] - '0';
      }
      res = res + r;
    }
  }
  return res;
}
int main() {
  int i, j, res, r, k;
  while (scanf("%d %d", &n, &k) != EOF) {
    for (i = 0; i < n; i++) {
      str[i] = '0' + i + 1;
    }
    str[n] = NULL;
    res = cal();
    r = 1;
    do {
      if (cal() == res) {
        if (r == k) break;
        r++;
      }
    } while (next_permutation(str, str + n));
    for (i = 0; i < n; i++) {
      if (i == 0)
        printf("%c", str[i]);
      else
        printf(" %c", str[i]);
    }
    printf("\n");
  }
  return 0;
}
