#include <bits/stdc++.h>
using namespace std;
int m;
void print(int ar[], int n) {
  for (int i = 0; i < n; i++) cout << ar[i] << " ";
  cout << endl;
}
int process(int ar[], int n) {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      sum += (*min_element(ar + i, ar + j + 1));
    }
  }
  return sum;
}
void permut(int ar[], int i, int n, int *value) {
  if (i == n) {
    *value = max(*value, process(ar, n));
    return;
  } else {
    for (int j = i; j < n; j++) {
      swap(ar[i], ar[j]);
      permut(ar, i + 1, n, value);
      swap(ar[i], ar[j]);
    }
  }
}
void solve(int ar[], int i, int n, int value, int *counter) {
  if (i == n) {
    if (process(ar, n) == value) {
      *counter = *counter + 1;
      if (*counter == m) print(ar, n);
    }
    return;
  } else {
    for (int j = i; j < n; j++) {
      swap(ar[i], ar[j]);
      solve(ar, i + 1, n, value, counter);
      swap(ar[i], ar[j]);
    }
  }
}
int main() {
  int n, value = 0;
  cin >> n >> m;
  int ar[n];
  for (int i = 0; i < n; i++) ar[i] = i + 1;
  permut(ar, 0, n, &value);
  int counter = 0;
  solve(ar, 0, n, value, &counter);
}
