#include <bits/stdc++.h>
using namespace std;
int a[100];
int main() {
  long long n, m;
  cin >> n >> m;
  int L = 0, R = n - 1;
  --m;
  long long sum = 0;
  for (int i = 1; i < n; ++i) {
    sum <<= 1;
    if (m & 1) sum += 1;
    m >>= 1;
  }
  m = sum;
  for (int i = 1; i <= n; m >>= 1, ++i) {
    if (m & 1) {
      a[R--] = i;
    } else {
      a[L++] = i;
    }
  }
  cout << a[0];
  for (int i = 1; i < n; ++i) {
    cout << " " << a[i];
  }
  cout << endl;
  return 0;
}
