#include <bits/stdc++.h>
using namespace std;
unsigned long long int pow2(unsigned long long int n) {
  unsigned long long int x;
  if (n == 0) return 1;
  x = pow2(n / 2);
  x *= x;
  if (n % 2 == 0) {
    return x;
  } else {
    return (x * 2);
  }
}
deque<int> f(int l, long long int k, long long int d) {
  if (l == 1) {
    deque<int> t;
    t.push_back(d + 1);
    return t;
  }
  if (k > pow2(l - 2)) {
    k -= pow2(l - 2);
    deque<int> t;
    t = f(l - 1, k, d + 1);
    t.push_back(d + 1);
    return t;
  } else {
    deque<int> t;
    t = f(l - 1, k, d + 1);
    t.push_front(d + 1);
    return t;
  }
}
int main() {
  int n;
  long long int k;
  cin >> n >> k;
  deque<int> t = f(n, k, 0);
  for (int i = 0; i < n; i++) cout << t[i] << " ";
  return 0;
}
