#include <bits/stdc++.h>
using namespace std;
const int MAXN = 55;
int N = 8;
long long M = 61;
vector<int> front, back;
void run() {
  for (int i = N - 2, j = 1; i >= 0; i--, j++) {
    long long now = (1LL << (int)i);
    if (M <= now) {
      front.push_back(j);
    } else {
      back.push_back(j);
      M -= now;
    }
  }
  for (int i = 0; i < front.size(); i++) printf("%d ", front[i]);
  printf("%d ", N);
  for (int i = back.size() - 1; i >= 0; i--) printf("%d ", back[i]);
}
int main() {
  scanf("%d %lld", &N, &M);
  run();
  return 0;
}
