#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long fp(vector<int>& p) {
  long long res = 0;
  for (__typeof(p.size()) i = (0) - ((0) > (p.size()));
       i != (p.size()) - ((0) > (p.size())); i += 1 - 2 * ((0) > (p.size()))) {
    int mn = p[i];
    for (__typeof(p.size()) j = (i) - ((i) > (p.size()));
         j != (p.size()) - ((i) > (p.size()));
         j += 1 - 2 * ((i) > (p.size()))) {
      mn = min(p[j], mn);
      res += mn;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    p[i] = i + 1;
  int cnt = 0;
  long long maxp = 0;
  vector<int> res = {};
  do {
    long long cur = fp(p);
    if (cur > maxp) {
      maxp = cur;
      cnt = 1;
    } else if (cur == maxp) {
      cnt++;
    }
    if (cur == maxp && cnt == m) res = p;
  } while (next_permutation(p.begin(), p.end()));
  for (__typeof(res.size()) i = (0) - ((0) > (res.size()));
       i != (res.size()) - ((0) > (res.size()));
       i += 1 - 2 * ((0) > (res.size())))
    cout << res[i] << " \n"[i == res.size() - 1];
  return 0;
}
