#include <bits/stdc++.h>   using namespace std;   int seq[100];   void display(const int n) {     for (int i = 0; i < n; ++i) printf( %d  , seq[i]);     putchar(  n );   }   int compute_sum(const int n) {     int sum = 0;     for (int i = 0; i < n; ++i) {       int x = seq[i];       for (int j = i; j < n; ++j) {         x = min(x, seq[j]);         sum += x;       }     }     return sum;   }   bool solve(const int n, int m) {     for (int i = 0; i < n; ++i) seq[i] = i + 1;     int best = 0;     do {       const int sum = compute_sum(n);       best = max(best, sum);     } while (next_permutation(seq, seq + n));     for (int i = 0; i < n; ++i) seq[i] = i + 1;     do {       const int sum = compute_sum(n);       if (sum == best) {         if (--m == 0) {           display(n);           return true;         }       }     } while (next_permutation(seq, seq + n));     return false;   }   void s(const long long x, const long long y, const int first) {     printf( visiting with x=%lld, y=%lld, first=%d n , x, y, first);     if (x <= 0) return;     assert(y < x);     long long delta = max(1LL, x >> 1);     long long index = 0;     int movements = 0;     for (;;) {       printf( index = %lld, delta = %lld, movements = %d n , index, delta,              movements);       if (index + delta <= y) {         movements += 1;         index += delta;       } else {         cout << first + movements <<     << endl;         s(x >> 1, y - index, first + 1);         break;       }       delta = max(1LL, delta >> 1);     }   }   vector<int> v;   void compute(const int l, const int r, long long m) {     if (l > r) return;     if (l == r) {       v.push_back(l);       return;     }     const long long x = 1LL << (r - l);     long long delta = max(1LL, x >> 1);     int movements = 0;     for (;;) {       const long long new_m = m - delta;       if (new_m >= 0) {         m = new_m;         movements += 1;         delta = max(1LL, delta >> 1);       } else {         const int first_digit = l + movements;         v.push_back(first_digit);         compute(first_digit + 1, r, m);         for (int i = l + movements - 1; i >= l; --i) v.push_back(i);         break;       }     }   }   void solve_fast(const int n, long long m) {}   void test() {     for (int n = 1; n <= 5; ++n) {       for (int m = 1; m <= 100; ++m) {         if (m <= 1LL << (n - 1)) {           if (solve(n, m)) {             v.clear();             compute(1, n, m - 1);             for (int i = 0; i < v.size(); ++i) printf( %d  , v[i]);             putchar(  n );           }         }       }       putchar(  n );     }   }   void run() {     int n;     long long m;     cin >> n >> m;     v.clear();     compute(1, n, m - 1);     for (int i = 0; i < v.size(); ++i) printf( %d  , v[i]);     putchar(  n );   }   int main() {     run();     return 0;   }   