#include <bits/stdc++.h>
using namespace std;
long long int tt;
vector<long long int> ans(55);
long long int n, m;
void mth_permutation(long long int x, long long int l, long long int r) {
  if (l == r) {
    ans[l] = x;
    return;
  }
  long long int s;
  s = ((long long int)1 << (r - l - 1));
  if (m >= s) {
    m = m - s;
    ans[r] = x;
    mth_permutation(x + 1, l, r - 1);
  } else {
    ans[l] = x;
    mth_permutation(x + 1, l + 1, r);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  m--;
  mth_permutation(1, 0, n - 1);
  for (long long int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
