#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:36777216")
using namespace std;
double sqr(double a) { return a * a; }
const long long int inf = 100000000000000000LL;
struct Node {
  vector<pair<int, int>> nbr;
  int used;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> p(n);
  for (int i = 0; i < n; ++i) {
    p[i] = i;
  }
  map<int, vector<string>> mp;
  long long int best = 0;
  do {
    long long int ans = 0;
    for (int i = 0; i < n; ++i) {
      long long int prev = p[i];
      for (int j = i; j < n; ++j) {
        prev = min(prev, p[j]);
        ans += prev + 1;
      }
    }
    if (ans >= best) {
      string s;
      for (int i = 0; i < n; ++i) {
        s += (char)(p[i] + '0' + 1);
        s += ' ';
      }
      best = max(ans, best);
      mp[ans].push_back(s);
    }
  } while (next_permutation(p.begin(), p.end()));
  sort(mp[best].begin(), mp[best].end());
  cout << mp[best][m - 1];
  return 0;
}
