#include <bits/stdc++.h>
using namespace std;
int mysum(const vector<int> &x) {
  int n = int(x.size());
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      ans += *min_element(x.begin() + i, x.begin() + j + 1);
    }
  }
  return ans;
}
struct mysort {
  bool operator()(const vector<int> &x, const vector<int> &y) const {
    int x0 = mysum(x), y0 = mysum(y);
    if (x0 != y0) return x0 > y0;
    return x < y;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  int64_t n, m;
  cin >> n >> m;
  --m;
  vector<int> p(n);
  ;
  ;
  for (int i = n - 2; i >= 0; --i)
    if (m & (int64_t(1) << i)) {
      for (int j = i - 1; j >= 0; --j) {
        m ^= (int64_t(1) << j);
      }
    };
  ;
  iota(begin(p), end(p), 1);
  for (int i = 0; i < n - 1; ++i)
    if (m & (int64_t(1) << i)) {
      ;
      ;
      reverse(end(p) - i - 2, end(p));
    }
  for (int v : p) cout << v << ' ';
  cout << '\n';
  return 0;
}
