#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  for (int i = 1; i <= n; i++) v.push_back(i);
  int min1 = -1;
  do {
    int x = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int mini = 100;
        for (int k = i; k <= j; k++) {
          mini = min(mini, v[k]);
        }
        x += mini;
      }
    }
    min1 = max(min1, x);
  } while (next_permutation(v.begin(), v.end()));
  sort(v.begin(), v.end());
  int cnt = 0;
  do {
    int x = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        int mini = 100;
        for (int k = i; k <= j; k++) {
          mini = min(mini, v[k]);
        }
        x += mini;
      }
    }
    if (min1 == x) {
      cnt++;
      if (cnt == m) {
        for (int i = 0; i < n; i++) cout << v[i] << " ";
        cout << "\n";
      }
    }
  } while (next_permutation(v.begin(), v.end()));
  return 0;
}
