#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T x, T y) {
  while (y > 0) {
    x %= y;
    swap(x, y);
  }
  return x;
}
template <class _T>
inline _T sqr(const _T& x) {
  return x * x;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795L;
template <typename T>
inline void input(T& a) {
  static int c;
  a = 0;
  while (!isdigit(c = getchar()) && c != '-') {
  }
  char neg = 0;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    a = 10 * a + c - '0';
    c = getchar();
  }
  if (neg) a = -a;
}
template <typename T = int>
inline T nxt() {
  T res;
  input(res);
  return res;
}
void solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  long long cnt;
  cin >> cnt;
  int ans[n];
  int l = 0, r = n - 1;
  for (int i = 0; i < n; ++i) {
    int len = r - l + 1;
    if (len == 1) {
      ans[l] = i;
      continue;
    }
    long long cc = (1ll << (len - 2));
    if (cc < cnt) {
      cnt -= cc;
      ans[r--] = i;
    } else {
      ans[l++] = i;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] + 1 << " ";
  }
  cout << "\n";
  return 0;
};
