#include <bits/stdc++.h>
using namespace std;
long long int dp[51];
int ans[51];
void solve(int s, int e, int val, long long int k) {
  if (s == e) {
    ans[s] = val;
    return;
  }
  int len = e - s;
  if (dp[len] < k) {
    k = k - dp[len];
    ans[e] = val;
    solve(s, e - 1, val + 1, k);
  } else {
    ans[s] = val;
    solve(s + 1, e, val + 1, k);
  }
}
int main() {
  dp[1] = 1;
  for (int i = 2; i <= 51; i++) dp[i] = 2 * dp[i - 1];
  long long int n, k;
  scanf("%lld", &n);
  scanf("%lld", &k);
  solve(0, n - 1, 1, k);
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}
