#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
int ans[777];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  long long m;
  cin >> n >> m;
  int a = 1, b = n;
  for (int i = 1; i <= n; i++) {
    if (m <= (1LL << (n - i - 1))) {
      ans[a] = i;
      a++;
    } else {
      ans[b] = i;
      b--;
      m -= (1LL << (n - i - 1));
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
