#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long n, m;
std::vector<int> b;
std::vector<int> e;
int main() {
  cin >> n >> m;
  --m;
  long long perms = (1LL << (n - 1));
  for (long long i = 0; i < (n - 1); ++i) {
    perms /= 2;
    if (m < perms) {
      b.push_back(i + 1);
    } else {
      e.push_back(i + 1);
    }
    m %= perms;
  }
  b.push_back(n);
  for (long long i = 0; i < (b.size()); ++i) cout << b[i] << " ";
  for (long long j = 0; j < (e.size()); ++j) cout << e[e.size() - j - 1] << " ";
  cout << endl;
}
