#include <bits/stdc++.h>
using namespace std;
int uz[57];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  long long m;
  cin >> n >> m;
  long long k = 1;
  for (int i = 2; i < n; ++i) k *= 2;
  int wyn = 1;
  while (m > 0 && k > 0) {
    if (m > k) {
      m -= k;
      k /= 2;
      wyn++;
    } else {
      cout << wyn << ' ';
      uz[wyn] = 1;
      wyn++;
      k /= 2;
    }
  }
  for (int i = n; i >= 1; --i)
    if (!uz[i]) cout << i << ' ';
  return 0;
}
