#include <bits/stdc++.h>
using namespace std;
long long arr[123], pre[123];
void solve(long long i, long long j, long long pos) {
  int mid = j - i + 1;
  if (i == j) {
    arr[i] = 1;
    return;
  } else {
    if (pre[mid - 1] >= pos) {
      arr[i] = 0;
      solve(i + 1, j, pos);
    } else {
      arr[j] = 0;
      solve(i, j - 1, pos - pre[mid - 1]);
    }
    for (long long k = i; k <= j; k++) arr[k]++;
  }
  return;
}
int main() {
  long long n, m;
  pre[1] = 1LL;
  for (int i = 1; i < 55; i++) {
    pre[i + 1] = pre[i] << 1LL;
  }
  cin >> n >> m;
  memset(arr, 0, sizeof(arr));
  solve(0, n - 1, m);
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
}
