#include <bits/stdc++.h>
using namespace std;
int n;
string data;
vector<string> ans;
long long val(string in) {
  int n = in.size();
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int mini = (int)2e9;
    for (int j = i; j < n; j++) {
      mini = min(mini, (in[j] - '0'));
      sum += mini;
    }
  }
  return sum;
}
int main() {
  int m;
  scanf("%d", &n);
  scanf("%d", &m);
  data = "";
  for (int i = 0; i < (int)n; i++) {
    data.push_back('0' + i + 1);
  }
  long long maxi = 0;
  do {
    long long temp = val(data);
    if (temp > maxi) {
      maxi = temp;
      ans.clear();
      ans.push_back(data);
    } else if (temp == maxi) {
      ans.push_back(data);
    }
  } while (next_permutation(data.begin(), data.end()));
  string an = ans[m - 1];
  for (int i = 0; i < n; i++) {
    cout << an[i] << " ";
  }
}
