#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const int MS = 100005;
const double EXP = 1e-8;
int a[55];
int n, m;
int calc() {
  int res = 0;
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      int maxv = n;
      for (int k = i; k <= j; k++)
        if (maxv > a[k]) maxv = a[k];
      res += maxv;
    }
  return res;
}
void solve() {
  int i, j;
  for (i = 0; i < n; i++) a[i] = i + 1;
  int maxv = -INF;
  do {
    int s = calc();
    if (maxv < s) maxv = s;
  } while (next_permutation(a, a + n));
  sort(a, a + n);
  do {
    int s = calc();
    if (maxv == s) {
      m--;
      if (!m) {
        for (i = 0; i < n; i++) {
          if (i) cout << " ";
          cout << a[i];
        }
        break;
      }
    }
  } while (next_permutation(a, a + n));
  return;
}
int main() {
  cin >> n >> m;
  solve();
  return 0;
}
