#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXN = 100;
long long pd[MAXN];
long long perm[MAXN];
int main() {
  long long n, m;
  pd[1] = 1;
  for (int i = 2; i < 60; ++i) pd[i] = pd[i - 1] * 2;
  while (cin >> n >> m) {
    long long a = 0, b = n - 1;
    m--;
    for (int i = 0; i < n; ++i) {
      long long x = b - a;
      if (pd[x] > m) {
        perm[a++] = i + 1;
      } else {
        perm[b--] = i + 1;
        m -= pd[x];
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << perm[i] << " ";
    }
    cout << endl;
  }
}
