#include <bits/stdc++.h>
using namespace std;
const int inft = 1000000009;
const int MAXN = 1000006;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<int> P(n);
  int beg = 0, kon = n - 1;
  for (int i = 0; i < (n); ++i) {
    if (k <= (1LL << (n - 2 - i)))
      P[beg++] = i + 1;
    else {
      k -= 1LL << (n - i - 2);
      P[kon--] = i + 1;
    }
  }
  for (int i = 0; i < (n); ++i) printf("%d ", P[i]);
}
int main() {
  int t = 1;
  for (int i = 0; i < (t); ++i) solve();
  return 0;
}
