#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxE(T& a, const T& b) {
  a = max(a, b);
}
template <typename T>
void minE(T& a, const T& b) {
  a = min(a, b);
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& t) {
  out << "[";
  for (auto i : t) out << i << ", ";
  out << "]";
  return out;
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T>& rhs) {
  out << "(" << rhs.first << "," << rhs.second << ")";
  return out;
}
const int INF = 1000 * 1000 * 1000 + 100;
vector<int> result;
void solve(int n, long long k, int offset) {
  if (0)
    cout << "n"
         << " " << n << " "
         << "k"
         << " " << k << " "
         << "offset"
         << " " << offset << " " << endl;
  if (n <= 1) {
    assert(k == 0);
    result.push_back(offset + 1);
    return;
  }
  if (k >= (1LL << (n - 2))) {
    solve(n - 1, k - (1LL << (n - 2)), offset + 1);
    result.push_back(offset + 1);
  } else {
    result.push_back(offset + 1);
    solve(n - 1, k, offset + 1);
  }
}
vector<int> t;
int main() {
  {
    int n;
    long long k;
    cin >> n >> k;
    k--;
    solve(n, k, 0);
    for (auto i : result) printf("%d ", i);
    printf("\n");
    return 0;
  }
  int n = 3;
  cin >> n;
  t.assign(n, 0);
  for (int i = 0; i < int(n); ++i) t[i] = i + 1;
  int best = 0;
  do {
    int s = 0;
    for (int i = 0; i < int(n); ++i)
      for (int j = i; j < n; j++) {
        int b = INF;
        for (int k = i; k <= j; k++) minE(b, t[k]);
        s += b;
      }
    maxE(best, s);
  } while (next_permutation((t).begin(), (t).end()));
  sort((t).begin(), (t).end());
  int allCnt = 0;
  do {
    int s = 0;
    for (int i = 0; i < int(n); ++i)
      for (int j = i; j < n; j++) {
        int b = INF;
        for (int k = i; k <= j; k++) minE(b, t[k]);
        s += b;
      }
    if (s == best) {
      cout << "t"
           << " " << t << " "
           << "s"
           << " " << s << " " << endl;
      allCnt++;
    }
  } while (next_permutation((t).begin(), (t).end()));
  if (0)
    cout << "allCnt"
         << " " << allCnt << " " << endl;
  return 0;
}
