#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  long long ans = 1;
  while (n != 1) {
    ans *= n;
    n--;
  }
  return ans;
}
int main() {
  long long n, m, k, mx = 0, kol1 = 0, pos;
  cin >> n >> m;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) a[i] = i + 1;
  long long p = fact(n);
  for (k = 0; k < p; k++) {
    long long kol = 0;
    for (int i = 0; i < n; i++)
      for (int j = i; j < n; j++) {
        long long mn = INT_MAX;
        for (int t = i; t <= j; t++) mn = min(mn, a[t]);
        kol += mn;
      }
    if (kol > mx) {
      mx = kol;
      kol1 = 0;
    }
    if (kol == mx) kol1++;
    if (kol1 == m && kol == mx) pos = k;
    next_permutation(a.begin(), a.end());
  }
  for (int i = 0; i < pos; i++) {
    next_permutation(a.begin(), a.end());
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
