#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& o, pair<A, B>& p) {
  return o << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "{";
  for (typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
    o << *it << ", ";
  return o << "}";
}
struct debugger {
  ostream& out;
  bool first;
  void start() { first = true; }
  debugger(ostream& out) : out(out) { start(); }
  void nl() {
    out << endl;
    start();
  }
  template <class T>
  debugger& operator,(T& v) {
    if (first)
      first = false;
    else
      out << ", ";
    out << v;
    return *this;
  }
  template <class T>
  debugger& operator,(pair<T*, int> arr) {
    out << "{";
    for (typeof((arr.second) - 1) i = (0); i <= ((arr.second) - 1); i++) {
      out << arr.first[i] << ", ";
    }
    out << "}";
    return *this;
  }
} dbg(cerr);
long long N;
void solve(long long k, long long n, deque<long long>& v) {
  if (n == 1) {
    v.push_back(N - n + 1);
    return;
  }
  if (k <= (1LL << (n - 2))) {
    v.push_back(N - n + 1);
    solve(k, n - 1, v);
    return;
  } else {
    solve(k - (1LL << (n - 2)), n - 1, v);
    v.push_back(N - n + 1);
    return;
  }
}
int main() {
  long long k;
  cin >> N >> k;
  deque<long long> d;
  solve(k, N, d);
  for (typeof(((int)d.size()) - 1) i = (0); i <= (((int)d.size()) - 1); i++) {
    cout << d[i] << " ";
  }
  return 0;
}
