#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.se << ")";
}
template <typename T1, typename T2>
inline ostream& operator<<(ostream& os, const map<T1, T2>& c) {
  bool first = true;
  os << "[";
  for (typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it) {
    if (!first) os << ", ";
    os << *it;
    first = false;
  }
  return os << "]";
}
template <typename T>
inline ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  os << "[";
  for (long long i = (0); i <= (((int)(v).size()) - 1); i += (1)) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline ostream& operator<<(ostream& os, const set<T>& c) {
  bool first = true;
  os << "[";
  for (typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it) {
    if (!first) os << ", ";
    os << *it;
    first = false;
  }
  return os << "]";
}
const int dx4[] = {-1, 0, 0, +1};
const int dx8[] = {-1, -1, -1, 0, 0, +1, +1, +1};
const int dy4[] = {0, -1, +1, 0};
const int dy8[] = {-1, 0, +1, -1, +1, -1, 0, +1};
unsigned long long m;
bool first;
vector<int> r, l;
int main() {
  int(n);
  scanf("%d", &(n));
  cin >> m;
  cerr << ("m") << " = " << (m) << endl;
  m--;
  r.push_back(n);
  n--;
  for (long long i = (0); i <= (n - 1); i += (1))
    if (m & (1LL << i))
      r.push_back(n - i);
    else
      l.push_back(n - i);
  bool first = true;
  for (long long i = (((int)(l).size()) - 1); i >= (0); i -= (1)) {
    if (!first) cout << ' ';
    first = false;
    cout << l[i];
  }
  for (long long i = (0); i <= (((int)(r).size()) - 1); i += (1)) {
    if (!first) cout << ' ';
    first = false;
    cout << r[i];
  }
  cout << endl;
  return 0;
}
