#include <bits/stdc++.h>
using namespace std;
vector<int> solve(int n, long long m) {
  if (n == 1) {
    assert(m == 1);
    vector<int> arr(1, 1);
    return arr;
  }
  vector<int> tans;
  long long temp = 1LL << (n - 2);
  int i;
  if (m <= temp) {
    tans = solve(n - 1, m);
    vector<int> ans(1, 1);
    for (i = 0; i < n - 1; i++) ans.push_back(tans[i] + 1);
    return ans;
  } else {
    tans = solve(n - 1, m - temp);
    vector<int> ans;
    for (i = 0; i < n - 1; i++) ans.push_back(tans[i] + 1);
    ans.push_back(1);
    return ans;
  }
}
template <typename T>
void print_arr(vector<T> &arr) {
  int s = int((arr).size()), i;
  for (i = 0; i < s; i++) cout << arr[i] << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, j;
  long long m;
  int n;
  cin >> n;
  ;
  cin >> m;
  vector<int> ans = solve(n, m);
  print_arr(ans);
}
