#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:36777216")
using namespace std;
double sqr(double a) { return a * a; }
const long long int inf = 100000000000000000LL;
struct Node {
  vector<pair<int, int> > nbr;
  int used;
};
vector<vector<int> > ans;
long long int n, m;
vector<int> c;
int l = 0, r;
vector<int> solve(int i, long long int m) {
  if (i == n) {
    return c;
  }
  long long int can = n - i - 1;
  can = 1 << can;
  if (m * 2 >= can) {
    c[r--] = i;
    return solve(i + 1, m - can / 2);
  } else {
    c[l++] = i;
    return solve(i + 1, m);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  cin >> n >> m;
  r = n - 1;
  c.resize(n);
  auto p = solve(0, m - 1);
  for (int i = 0; i < p.size(); ++i) {
    cout << p[i] + 1 << " ";
  }
  return 0;
}
