#include <bits/stdc++.h>
using namespace std;
bool compare(pair<long long, vector<int> > a, pair<long long, vector<int> > b) {
  if (a.first != b.first) {
    return a.first > b.first;
  }
  return a.second < b.second;
}
int main() {
  long long N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    A[i] = i + 1;
  }
  vector<pair<long long, vector<int> > > Q;
  do {
    long long sum = 0;
    for (int i = 0; i < N; ++i) {
      for (int j = i; j < N; ++j) {
        sum += *min_element(A.begin() + i, A.begin() + j + 1);
      }
    }
    Q.push_back({sum, A});
  } while (next_permutation(A.begin(), A.end()));
  sort(Q.begin(), Q.end(), compare);
  for (int i = 0; i < N; ++i) {
    cout << Q[M - 1].second[i] << " ";
  }
  cout << "\n";
  return 0;
}
