#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int min(int a, int b) {
  if (a > b)
    return b;
  else
    return a;
}
int main() {
  double epsilon = 1e-7;
  int n;
  long long m, k = 1;
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    k *= 2;
  }
  int arr[50];
  int left = -1, right = 0;
  for (int i = 1; i <= n; i++) {
    k /= 2;
    if (m > k) {
      right++;
      arr[n - right] = i;
      m -= k;
    } else {
      left++;
      arr[left] = i;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << arr[i] << ' ';
  }
}
