#include <bits/stdc++.h>
using namespace std;
int cal(vector<int> q, int n, int m) {
  int sum = 0;
  for (int i = (int)0; i < (int)n; ++i) {
    for (int j = (int)i; j < (int)n; ++j) {
      int mn = INT_MAX;
      for (int k = (int)i; k < (int)j + 1; ++k)
        mn = ((mn) < (q[k]) ? (mn) : (q[k]));
      sum += mn;
    }
  }
  return sum;
}
int main() {
  int i, j, n, t;
  int m;
  scanf("%d", &n);
  scanf("%d", &m);
  vector<int> q;
  for (int i = (int)1; i < (int)n + 1; ++i) q.push_back(i);
  int mx = 0;
  do {
    mx = ((mx) > (cal(q, n, m)) ? (mx) : (cal(q, n, m)));
  } while (next_permutation(q.begin(), q.end()));
  sort(q.begin(), q.end());
  int cnt = 0;
  do {
    if (cal(q, n, m) == mx) cnt++;
    if (cnt == m) break;
  } while (next_permutation(q.begin(), q.end()));
  for (int i = (int)0; i < (int)n; ++i) printf("%d ", q[i]);
  printf("\n");
  return 0;
}
