#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int main(void) {
  int n1, n2, i, j, k, n, d;
  cin >> n >> d;
  for (i = 0; i < n; i++) vec.push_back(i + 1);
  int Min, Max = 0, sum;
  do {
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        Min = vec[i];
        for (k = i; k <= j; k++) Min = min(vec[k], Min);
        sum += Min;
      }
    }
    Max = max(Max, sum);
  } while (std::next_permutation(vec.begin(), vec.end()));
  int count = 0;
  sort(vec.begin(), vec.end());
  do {
    sum = 0;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++) {
        Min = vec[i];
        for (k = i; k <= j; k++) Min = min(vec[k], Min);
        sum += Min;
      }
    }
    if (sum == Max) {
      count++;
      if (count == d) break;
    }
  } while (std::next_permutation(vec.begin(), vec.end()));
  for (i = 0; i < n; i++) cout << vec[i] << " ";
}
