#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
const int MAXN = 55;
int n, ans[MAXN];
long long m;
int main() {
  scanf(
      "%d "
      "%lld",
      &n, &m);
  int i = 0, j = n - 1;
  for (int k = 1; i < j; k++) {
    if (m > (1LL << (j - i - 1))) {
      m -= (1LL << (j - i - 1));
      ans[j--] = k;
    } else
      ans[i++] = k;
  }
  ans[i] = n;
  for (int k = 0; k < n; k++) printf("%d ", ans[k]);
  putchar('\n');
  return 0;
}
