#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int power(long long int two, long long int n) {
  long long int x;
  if (n == 1)
    return two % mod;
  else {
    x = power(two, n / 2) % mod;
    if (n % 2 != 0)
      return (((x * x) % mod) * two) % mod;
    else
      return (x * x) % mod;
  }
}
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    gcd(b, a % b);
}
int arr[10], m;
int visit[10] = {0};
void find_per(int i, int n, int pp) {
  int j, min, k, p, s = 0;
  if (i == n + 1) {
    for (j = 1; j <= n; j++) {
      for (k = j; k <= n; k++) {
        min = 99;
        for (p = j; p <= k; p++) {
          if (arr[p] < min) {
            min = arr[p];
          }
        }
        s = s + min;
      }
    }
    if (s == pp) {
      m--;
      if (m == 0) {
        for (j = 1; j <= n; j++) {
          printf("%d ", arr[j]);
        }
        printf("\n");
        return;
      }
    }
  }
  for (j = 1; j <= n; j++) {
    if (visit[j] == 0) {
      arr[i] = j;
      visit[j] = 1;
      find_per(i + 1, n, pp);
      visit[j] = 0;
    }
  }
}
int main() {
  int j, k, n;
  int p, min, s = 0;
  scanf("%d%d", &n, &m);
  for (j = 1; j <= n; j++) {
    for (k = j; k <= n; k++) {
      min = 99;
      for (p = j; p <= k; p++) {
        if (p < min) {
          min = p;
        }
      }
      s = s + min;
    }
  }
  find_per(1, n, s);
  return 0;
}
