#include <bits/stdc++.h>
using namespace std;
bool Active(long long val, long long pos) { return ((val >> pos) & 1) ? 1 : 0; }
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  m--;
  vector<long long> ans(n + 1, 0);
  long long l = 1;
  long long r = n;
  for (long long i = 1; i <= n; i++) {
    if (Active(m, n - i - 1))
      ans[r--] = i;
    else
      ans[l++] = i;
  }
  for (long long i = 1; i <= n; i++) cout << ans[i] << ' ';
}
