#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long inf_ll = 0x7f7f7f7f;
const double eps = 1e-8;
const int bfs_dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int bfs_dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int dfs_dy[] = {0, 1, 0, -1};
const int dfs_dx[] = {1, 0, -1, 0};
pair<int, int> dir[] = {make_pair(0, 1), make_pair(1, 0), make_pair(0, -1),
                        make_pair(-1, 0)};
class A {
 public:
  vector<int> biu;
  int id;
  int _f;
  void f() {
    int ans = 0;
    for (int i = 0; i < biu.size(); i++) {
      int _min = biu[i];
      for (int j = i; j < biu.size(); j++) {
        _min = min(_min, biu[j]);
        ans += _min;
      }
    }
    _f = ans;
  }
  friend bool operator<(const A& a, const A& b) {
    return a._f < b._f || (a._f == b._f && a.id > b.id);
  }
};
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    p[i] = i + 1;
  }
  set<A> s;
  int cnt = 0;
  do {
    A a;
    a.biu = p;
    a.f();
    a.id = cnt++;
    s.insert(a);
  } while (next_permutation(p.begin(), p.end()));
  for (auto idx = s.rbegin(); idx != s.rend(); idx++) {
    m--;
    if (m == 0) {
      for (auto j : idx->biu) {
        cout << j << ' ';
      }
      cout << endl;
      break;
    }
  }
}
