#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  m--;
  bitset<64> b(m);
  vector<bool> a(n - 1);
  for (int i = 0; i < n - 1; i++) {
    a[n - i - 1 - 1] = b[i];
  }
  vector<int> arr(n);
  int numtoBePlaced = 1;
  int left = 0;
  int right = n - 1;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == 0) {
      arr[left] = numtoBePlaced;
      left++;
      numtoBePlaced++;
    } else {
      arr[right] = numtoBePlaced;
      right--;
      numtoBePlaced++;
    }
  }
  for (int i = 0; i < n; i++)
    if (arr[i] == 0) arr[i] = n;
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
  return 0;
}
