#include <bits/stdc++.h>
using namespace std;
int A[55];
void solve(int st, int en, int offset, long long M) {
  if (M > (1ll << (en - st))) {
    exit(-1);
  }
  if (M == (1ll << (en - st))) {
    int last_number = en - st + offset;
    for (int j = st; j <= en; j++) {
      A[j] = last_number - (j - st);
    }
    return;
  }
  if (M <= (1ll << (en - st - 1))) {
    A[st] = offset;
    solve(st + 1, en, offset + 1, M);
  } else {
    A[en] = offset;
    solve(st, en - 1, offset + 1, M - (1ll << (en - st - 1)));
  }
}
void solvebrute(int N, int M) {
  vector<int> A(N, 0);
  for (int i = 0; i < N; i++) A[i] = i + 1;
  vector<int> Ao;
  int maxval = 0;
  int ct = 0;
  do {
    int curr = 0;
    for (int i = 0; i < N; i++) {
      for (int j = i; j < N; j++) {
        int t = N + 1;
        for (int k = i; k <= j; k++) t = min(t, A[k]);
        curr += t;
      }
    }
    if (curr >= maxval) {
      maxval = curr;
      Ao = A;
      ct++;
      if (ct == M) {
        break;
      }
    }
  } while (next_permutation(A.begin(), A.end()));
  for (int i = 0; i < Ao.size(); i++) printf("%d ", Ao[i]);
  printf("\n");
}
int main() {
  long long N, M;
  cin >> N >> M;
  solve(1, N, 1, M);
  for (int i = 1; i <= N; i++) printf("%d ", A[i]);
  printf("\n");
}
