#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:268435456")
const int maxn = 100001;
const long long inf = 2147483647;
long long a[50000][51], ans[50000], numb = 0;
long long n, m;
void gener(vector<long long> c, vector<long long> b) {
  vector<long long> d, e;
  if (c.size() == n) {
    for (int i = 0; i < n; ++i) a[numb][i] = c[i];
    ++numb;
    return;
  }
  for (int i = 0; i < b.size(); ++i) {
    d = c;
    e = b;
    d.push_back(e[i]);
    e.erase(e.begin() + i);
    gener(d, e);
  }
}
int main() {
  cin.sync_with_stdio(0);
  vector<long long> b, c;
  long long step[51];
  long long minn, maxx = 0;
  deque<long long> d;
  cin >> n >> m;
  step[0] = 1;
  for (int i = 1; i < 51; ++i) step[i] = step[i - 1] * 2;
  d.push_back(n);
  for (int i = n - 1; i >= 1; --i) {
    if ((m - 1) % step[n - i] >= step[n - i - 1]) {
      d.push_back(i);
    } else
      d.push_front(i);
  }
  for (int i = 0; i < n; ++i) cout << d[i] << ' ';
  return 0;
}
