#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100];
long long ans;
long long getval() {
  long long val = 0;
  for (int i = 0; i < n; ++i) {
    int mn = 100500;
    for (int j = i; j < n; ++j) {
      mn = min(mn, a[j]);
      val += mn;
    }
  }
  return val;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    a[i] = i + 1;
  }
  do {
    long long val = getval();
    ans = max(ans, val);
  } while (next_permutation(a, a + n));
  cerr << "ans = " << ans << "\n";
  do {
    long long val = getval();
    if (val == ans) {
      if (m == 1) {
        for (int i = 0; i < n; ++i) {
          cout << a[i] << " ";
        }
        cout << "\n";
        return 0;
      }
      --m;
    }
  } while (next_permutation(a, a + n));
}
