#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T poww(T b, T p) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T poww2(T b, int p) {
  T a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T modpoww(T b, T p, T mmod) {
  if (p == 0 && b == 0) return 0;
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b) % mmod;
    }
    p >>= 1;
    b = (b * b) % mmod;
  }
  return a % mmod;
}
template <class T>
inline T gcd(T a, T b) {
  if (b > a) return gcd(b, a);
  return ((b == 0) ? a : gcd(b, a % b));
}
inline void scand(vector<int>& a, int n) {
  int b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    scanf("%d", &(b));
    a.push_back(b);
  }
}
template <class T>
inline void scan(vector<T>& a, int n) {
  T b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    cin >> b;
    a.push_back(b);
  }
}
long long n, m;
vector<vector<int> > b;
int main() {
  long long i, j, k;
  cin >> n >> m;
  vector<int> a(n);
  int s = 0, e = n - 1, nm = 1;
  while (s <= e) {
    if (e > s)
      k = 1LL << (e - s - 1);
    else
      k = 0;
    if (k >= m) {
      a[s++] = nm++;
    } else {
      a[e--] = nm++;
      m -= k;
    }
  }
  for ((i) = 0; (i) < (a.size()); (i) += 1) cout << a[i] << " ";
  cout << "\n";
}
