#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, sum, res = -1, mn = 10000005, k, cnt = 0, flag = 0;
  scanf("%d%d", &n, &m);
  int a[n + 5];
  for (i = 0; i < n; i++) a[i] = i + 1;
  do {
    sum = 0;
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) {
        mn = 10000005;
        for (k = i; k <= j; k++)
          if (a[k] < mn) mn = a[k];
        sum += mn;
      }
    if (res < sum) res = sum;
  } while (next_permutation(a, a + n));
  cnt = 0;
  for (i = 0; i < n; i++) a[i] = i + 1;
  do {
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        mn = 10000005;
        for (k = i; k <= j; k++)
          if (a[k] < mn) mn = a[k];
        sum += mn;
        if (sum == res) cnt++;
        if (cnt == m) {
          flag = 1;
          break;
        }
      }
      if (flag == 1) break;
    }
    if (flag == 1) {
      for (i = 0; i < n; i++) printf("%d ", a[i]);
      printf("\n");
      break;
    }
  } while (next_permutation(a, a + n));
  return 0;
}
