#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
const long long mod = 1e9 + 7;
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long M = 300 + 10;
const long long N = 150 * 1000 + 10;
long long a[N];
int main() {
  faster();
  long long n, m;
  cin >> n >> m;
  long long x = n - 2;
  long long l = 1;
  long long r = n;
  long long cur = 1;
  for (long long i = 0; i < n; i++) {
    long long cnt = (1ll << x--);
    if (m > cnt) {
      a[r--] = cur++;
      m -= cnt;
    } else {
      a[l++] = cur++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << a[i] << " ";
  }
}
