#include <bits/stdc++.h>
using namespace std;
vector<int> p, a[40330], res;
int too = 0;
int mx;
int calcFunct() {
  int sum = 0;
  for (int i = 0; i < p.size(); i++) {
    for (int j = 0; j < p.size(); j++) {
      int mn = 10000007;
      for (int k = i; k <= j; k++) {
        mn = min(mn, p[k]);
      }
      sum += mn;
    }
  }
  return sum;
}
void copy() {
  for (int i = 0; i < p.size(); i++) {
    a[too].push_back(p[i]);
  }
  return;
}
void calcPermutation() {
  copy();
  mx = calcFunct();
  res.push_back(mx);
  too++;
  while (next_permutation(p.begin(), p.end())) {
    copy();
    int val = calcFunct();
    res.push_back(val);
    too++;
    mx = max(mx, val);
  }
  return;
}
int find(int m) {
  int k = 0;
  for (int i = 0; i < res.size(); i++) {
    if (res[i] == mx) {
      k++;
      if (k == m) return i;
    }
  }
  return -1;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    p.push_back(i);
  }
  calcPermutation();
  int val = find(m);
  if (val > -1) {
    for (int i = 0; i < a[val].size(); i++) {
      cout << a[val][i] << " ";
    }
    cout << endl;
  }
  return 0;
}
