#include <bits/stdc++.h>
const long long OO = 1000000007;
const int MAXN = 100005;
using namespace std;
int n;
long long m;
int p[55];
int now = 1;
void work(int l, int r, long long ll, long long rr) {
  if (l == r) return;
  long long mid = (rr + ll + 1) / 2;
  if (m >= mid) {
    p[--r] = now++;
    ll = mid;
  } else {
    p[l++] = now++;
    rr = mid - 1;
  }
  work(l, r, ll, rr);
}
int main() {
  cin >> n >> m;
  long long cnt = 1;
  for (int i = 0; i < (n - 1); ++i) cnt *= 2;
  work(0, n, 1, cnt);
  for (int i = 0; i < n; ++i) cout << p[i] << " ";
  return 0;
}
