#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<int, int>& p1, const pair<int, int>& p2) {
  return p1.first < p2.first;
}
long long int ans[55], out[55];
int main() {
  int n;
  long long int m;
  scanf("%d", &n);
  scanf("%I64d", &m);
  out[n - 1] = 1;
  for (int i = n - 2; i >= 0; i--) out[i] = out[i + 1] * 2;
  int st = 1;
  int en = n;
  for (int i = 1; i < n; i++) {
    if (out[i] < m) {
      ans[en] = i;
      en--;
      m = m - out[i];
    } else {
      ans[st] = i;
      st++;
    }
  }
  ans[st] = n;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
