#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long n, m;
  cin >> n >> m;
  int A[n];
  int beg = 0, end = n - 1;
  for (int i = 0; i < n; i++)
    if (m > (1LL << (n - 2 - i))) {
      A[end--] = i + 1;
      m -= (1LL << (n - 2 - i));
    } else
      A[beg++] = i + 1;
  for (int i = 0; i < n; i++) cout << A[i] << " ";
  cout << endl;
  return 0;
}
