#include <bits/stdc++.h>
using namespace std;
long long int po(long long int a, long long int b, long long int c) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % c;
    b = b / 2;
    a = (a * a) % c;
  }
  return ans;
}
long long int po(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % 1000000007;
    b = b / 2;
    a = (a * a) % 1000000007;
  }
  return ans;
}
void ithPermutation(const int n, int i) {
  int j, k = 0;
  int *fact = (int *)calloc(n, sizeof(int));
  int *perm = (int *)calloc(n, sizeof(int));
  fact[k] = 1;
  while (++k < n) fact[k] = fact[k - 1] * k;
  for (k = 0; k < n; ++k) {
    perm[k] = i / fact[n - 1 - k];
    i = i % fact[n - 1 - k];
  }
  for (k = n - 1; k > 0; --k)
    for (j = k - 1; j >= 0; --j)
      if (perm[j] <= perm[k]) perm[k]++;
  for (k = 0; k < n; ++k) printf("%d ", perm[k] + 1);
  printf("\n");
  free(fact);
  free(perm);
}
int main() {
  int n1, n2, i, j, k, n, d;
  cin >> n >> d;
  vector<int> vv;
  for (i = 0; i < n; i++) vv.push_back(i + 1);
  int Min, maxi = 0, sum;
  do {
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        Min = vv[i];
        for (k = i; k <= j; k++) Min = min(vv[k], Min);
        sum += Min;
      }
    }
    maxi = max(maxi, sum);
  } while (std::next_permutation(vv.begin(), vv.end()));
  int count = 0;
  sort(vv.begin(), vv.end());
  do {
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        Min = vv[i];
        for (k = i; k <= j; k++) Min = min(vv[k], Min);
        sum += Min;
      }
    }
    if (sum == maxi) {
      count++;
      if (count == d) break;
    }
  } while (std::next_permutation(vv.begin(), vv.end()));
  for (i = 0; i < n; i++) cout << vv[i] << " ";
  return 0;
}
