#include <bits/stdc++.h>
using namespace std;
int M, N;
void solve(int* arr, int n, long long m, int next) {
  if (n == 1) {
    arr[0] = next;
    return;
  }
  long long one = 1;
  long long half = one << (n - 2);
  if (m > half) {
    arr[n - 1] = next;
    solve(arr, n - 1, m - half, next + 1);
  } else {
    arr[0] = next;
    solve(arr + 1, n - 1, m, next + 1);
  }
}
int main() {
  int t, tc, x, y, z;
  int i, j, k, l, h, pos;
  char ch;
  int n;
  long long m;
  cin >> n >> m;
  int arr[150];
  solve(arr, n, m, 1);
  for (int i = 0; i < n; i++) cout << arr[i] << ' ';
  cout << endl;
  return 0;
}
