#include <bits/stdc++.h>
using namespace std;
const int N = 500;
int p[N];
int main() {
  int n, m;
  cin >> n >> m;
  int ans = 0, bt = 0, pos = 1, mn = 0;
  int mas[N][N] = {0};
  for (int i = 1; i <= n; i++) p[i] = i;
  do {
    for (int i = 1; i <= n; i++) {
      mn = p[i];
      for (int j = i; j <= n; j++) {
        mn = min(mn, p[j]);
        ans += mn;
      }
    }
    if (ans > bt) {
      for (int i = 1; i <= pos; i++)
        for (int j = 1; j <= n; j++) mas[i][j] = 0;
      pos = 1;
      for (int i = 1; i <= n; i++) {
        mas[pos][i] = p[i];
      }
      pos++;
      bt = ans;
    } else if (ans == bt) {
      for (int i = 1; i <= n; i++) {
        mas[pos][i] = p[i];
      }
      pos++;
    }
    ans = 0;
  } while (std::next_permutation(p + 1, p + n + 1));
  for (int i = 1; i <= n; i++) cout << mas[m][i] << " ";
  cout << endl;
  return 0;
}
