#include <bits/stdc++.h>
using namespace std;
long long n, m, a[100], val, fg;
long long cnt = 0;
void print(long long i) {
  if (i == n + 1) {
    long long j, k, ans;
    ans = 0;
    for (j = 1; j <= n; j++) {
      long long an = a[j];
      for (k = j; k <= n; k++) {
        if (a[k] <= an) {
          ans += a[k];
          an = a[k];
        } else {
          ans += an;
        }
      }
    }
    if (ans == val) {
      cnt++;
    }
    if (cnt == m && fg == 0) {
      fg = 1;
      for (j = 1; j <= n; j++) {
        cout << a[j] << " ";
      }
      cout << endl;
      return;
    }
  } else {
    long long j;
    for (j = i; j <= n; j++) {
      long long t = a[i];
      a[i] = a[j];
      a[j] = t;
      print(i + 1);
      t = a[i];
      a[i] = a[j];
      a[j] = t;
    }
  }
}
int main() {
  long long i;
  cin >> n >> m;
  fg = 0;
  for (i = 1; i <= n; i++) {
    a[i] = i;
  }
  for (i = 1; i <= n; i++) {
    val = val + i * (n - i + 1);
  }
  print(1);
  return 0;
}
