#include <bits/stdc++.h>
using namespace std;
void solve(int testcase) {
  long long int n, m, l, r, lo, hi, mid;
  cin >> n >> m;
  lo = 1;
  hi = 1LL << (n - 1);
  l = 1;
  r = n;
  int ans[55], cur = 1;
  while (l <= r) {
    mid = (lo + hi) / 2;
    if (m <= mid) {
      ans[l++] = cur++;
      hi = mid;
    } else {
      ans[r--] = cur++;
      lo = mid + 1;
    }
  }
  for (int i = (1); i <= (n); i++) cout << ans[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(20);
  clock_t b = clock();
  int t = 1;
  for (int tt = (1); tt <= (t); tt++) solve(tt);
  clock_t e = clock();
  cerr << (double(e - b) / CLOCKS_PER_SEC) << " sec";
  return 0;
}
