// ========================
// Compilador online da OBI
// ========================

#include <bits/stdc++.h>
using namespace std;

#define int long long

const int MAX = 1e5 + 8;
const int LG = 60;

void solve() {
    int n, k; cin >> n >> k; k--;

    vector<int> esq, dir;

    for(int x = 2; x <= n; x++) {
        int bit = x - 2;
        if(bit <= LG && ((k >> bit) & 1LL)) esq.push_back(x);
        else dir.push_back(x);
    }
    
    for(int i = (int)esq.size() - 1; i >= 0; i--) {
        cout << esq[i] << ' ';
    }
    cout << 1 << ' ';

    for(int i = 0; i < dir.size(); i++) {
        cout << dir[i] << ' ';
    }
    cout << '\n';


}

signed main() {
    // comandos para agilizar entrada/saída
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();

    // Digite seu código aqui, por exemplo:
    // cout << "resposta" << endl;

    return 0;
}