#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int n, res[300005];
long long k;
void cal(int id, int l, int r, long long T) {
  if (id == n) {
    res[l] = n;
    return;
  }
  long long x = (1ll << (r - l - 1));
  if (T < x) {
    res[l] = id;
    cal(id + 1, l + 1, r, T);
  } else {
    res[r] = id;
    cal(id + 1, l, r - 1, T - x);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  k--;
  cal(1, 1, n, k);
  for (int i = (1); i <= (n); ++i) cout << res[i] << " ";
  return 0;
}
