#include <bits/stdc++.h>
using namespace std;
struct debug_t {
  template <typename T>
  debug_t& operator<<(const T& value) {
    return *this;
  }
} debug;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  long long m;
  while (cin >> n >> m) {
    m--;
    long long area = 1LL << (n - 1);
    int cur = 1;
    bool used[50] = {};
    while (cur <= n) {
      area >>= 1;
      if (m < area) {
        cout << cur << ' ';
        used[cur - 1] = true;
      } else
        m -= area;
      cur++;
    }
    for (cur = n; cur; cur--)
      if (!used[cur - 1]) cout << cur << ' ';
    cout << '\n';
  }
}
