#include <bits/stdc++.h>
using namespace std;
void impr(vector<int> &v) {
  for (int i = 0; i < ((int)v.size()); ++i)
    printf("%d%c", v[i], i + 1 == ((int)v.size()) ? 10 : 32);
}
long long f(vector<int> &v) {
  int n = ((int)v.size());
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    int mini = 1 << 30;
    for (int j = i; j < n; ++j) {
      mini = min(mini, v[j]);
      ans += mini;
    }
  }
  return ans;
}
int main() {
  int n;
  long long m;
  while (cin >> n >> m) {
    vector<int> v(n);
    for (int i = 0; i < n; ++i) v[i] = i + 1;
    long long maxi = 0;
    do {
      long long val = f(v);
      maxi = max(maxi, val);
    } while (next_permutation(v.begin(), v.end()));
    for (int i = 0; i < n; ++i) v[i] = i + 1;
    do {
      long long val = f(v);
      if (val == maxi) m--;
      if (m == 0) {
        impr(v);
        break;
      }
    } while (next_permutation(v.begin(), v.end()));
  }
}
