#include <bits/stdc++.h>
using namespace std;
int R[100];
long long pot[100];
void solve(int i, int j, long long pos) {
  int lon = j - i + 1;
  if (i == j) {
    R[i] = 1;
    return;
  } else {
    if (pot[lon - 1] >= pos) {
      R[i] = 0;
      solve(i + 1, j, pos);
    } else {
      R[j] = 0;
      solve(i, j - 1, pos - pot[lon - 1]);
    }
    for (int k = (i); k < (j + 1); k++) R[k]++;
  }
  return;
}
int main() {
  int n;
  long long m;
  pot[1] = 1LL;
  for (int i = (1); i < (55); i++) pot[i + 1] = pot[i] << 1LL;
  cin >> n >> m;
  for (int i = (0); i < (n); i++) R[i] = 0;
  solve(0, n - 1, m);
  for (int i = (0); i < (n); i++) {
    if (i) printf(" ");
    printf("%d", R[i]);
  }
  return 0;
}
