#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = INT_MAX;
int main() {
  int a[55];
  long long n, m;
  cin >> n >> m;
  int st = 0;
  int en = n - 1;
  for (int i = 1; i <= n; i++) {
    if (m <= (1LL << (n - i - 1))) {
      a[st] = i;
      st++;
    } else {
      m = m - (1LL << (n - i - 1));
      a[en] = i;
      en--;
    }
  }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
