#include <bits/stdc++.h>
using namespace std;
void f(long long n, long long m, long long s) {
  if (n == 1) {
    cout << s << " ";
    return;
  }
  if (m <= ((long long)1 << (n - 2))) {
    cout << s << " ";
    f(n - 1, m, s + 1);
  } else {
    f(n - 1, m - ((long long)1 << (n - 2)), s + 1);
    cout << s << " ";
  }
}
int main() {
  long long n, m;
  cin >> n >> m;
  f(n, m, 1);
}
