#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    a[i] = i + 1;
  }
  int maxV = 0;
  vector<int> vals;
  do {
    int val = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = i; j < n; ++j) {
        int mn = 100;
        for (int k = i; k <= j; ++k) {
          if (a[k] < mn) mn = a[k];
        }
        val += mn;
      }
    }
    vals.push_back(val);
    if (val > maxV) maxV = val;
  } while (next_permutation(a.begin(), a.end()));
  int p = 0;
  do {
    if (vals[p] == maxV) --m;
    if (m == 0) {
      for (int i = 0; i < n - 1; ++i) {
        cout << a[i] << ' ';
      }
      cout << a[n - 1] << endl;
      break;
    }
    ++p;
  } while (next_permutation(a.begin(), a.end()));
  return 0;
}
