#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  vector<int> v(n);
  --m;
  long long int c = 1;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = 0; i < (int)n - 2; ++i) c *= 2;
  int k = 1;
  int ptr1 = 0;
  int ptr2 = n - 1;
  while (ptr1 <= ptr2) {
    if (m < c) {
      v[ptr1++] = k++;
    } else {
      v[ptr2--] = k++;
      m -= c;
    }
    c /= 2;
  }
  for (int i = 0; i < (int)n; ++i) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
