#include <bits/stdc++.h>
using namespace std;
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template <class A>
string to_string(complex<A> c) {
  stringstream ss;
  ss << c;
  return ss.str();
}
string to_string(vector<bool> v) {
  string res = "{";
  for (int i = 0; i < (int)v.size(); i++) res += char('0' + v[i]);
  res += "}";
  return res;
}
template <size_t SZ>
string to_string(bitset<SZ> b) {
  string res = "";
  for (size_t i = 0; i < SZ; i++) res += char('0' + b[i]);
  return res;
}
template <class A, class B>
string to_string(pair<A, B> p);
template <class T>
string to_string(T v) {
  bool fst = 1;
  string res = "{";
  for (const auto& x : v) {
    if (!fst) res += ", ";
    fst = 0;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <class A, class B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const int MOD = 1e9 + 7, INF = 1e9 + 5;
inline long long powmod(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % MOD)
    if (b & 1) res = res * a % MOD;
  return res;
}
inline long long power(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a)
    if (b & 1) res = res * a;
  return res;
}
const int MAXN = 2e5 + 10;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 1; i <= n; i++) a[i - 1] = i;
  deque<pair<int, vector<int>>> have;
  int mx = 0;
  do {
    int tans = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int mn = INF;
        for (int q = i; q <= j; q++) {
          mn = min(mn, a[q]);
        }
        tans += mn;
      }
    }
    have.push_back({tans, a});
    mx = max(mx, tans);
  } while (next_permutation(a.begin(), a.end()));
  m--;
  sort(have.begin(), have.end());
  while (have.front().first != mx) have.pop_front();
  for (int i : have[m].second) cout << i << ' ';
  cout << '\n';
}
