#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, sum, cur = 0, minval = 0, maxval = 0;
  cin >> n >> m;
  long long a[n + 2];
  for (long long i = 0; i < n; i++) {
    a[i] = i + 1;
  }
  do {
    sum = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = i; j < n; j++) {
        minval = a[i];
        for (long long k = i; k <= j; k++) {
          minval = min(a[k], minval);
        }
        sum += minval;
      }
    }
    maxval = max(maxval, sum);
  } while (next_permutation(a, a + n));
  for (long long i = 0; i < n; i++) {
    a[i] = i + 1;
  }
  do {
    sum = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = i; j < n; j++) {
        minval = a[i];
        for (long long k = i; k <= j; k++) {
          minval = min(a[k], minval);
        }
        sum += minval;
      }
    }
    if (sum == maxval) {
      cur++;
    }
    if (cur == m) {
      break;
    }
  } while (next_permutation(a, a + n));
  for (long long i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
  return 0;
}
