#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d;
  int xx[10];
  int yy[10];
  while (~scanf("%d %d", &a, &b)) {
    for (int i = 0; i < a; i++) {
      xx[i] = i + 1;
    }
    int maxx = 0;
    do {
      int minn = 100;
      int kk = 0;
      int sum = 0;
      int sum1 = 0;
      for (int i = 0; i < a; i++) {
        sum = 0;
        for (int j = i; j < a; j++) {
          minn = 100;
          for (int k = i; k <= j; k++) {
            if (xx[k] < minn) {
              minn = xx[k];
            }
          }
          sum += minn;
        }
        sum1 += sum;
      }
      if (sum1 > maxx) {
        maxx = sum1;
      }
    } while (next_permutation(xx, xx + a));
    int summ = 0;
    sort(xx, xx + a);
    do {
      int minn = 100;
      int kk = 0;
      int sum = 0;
      int sum1 = 0;
      for (int i = 0; i < a; i++) {
        sum = 0;
        for (int j = i; j < a; j++) {
          minn = 100;
          for (int k = i; k <= j; k++) {
            if (xx[k] < minn) {
              minn = xx[k];
            }
          }
          sum += minn;
        }
        sum1 += sum;
      }
      if (sum1 == maxx) {
        summ++;
      }
      if (summ == b) {
        for (int i = 0; i < a; i++) {
          printf(i == a - 1 ? "%d\n" : "%d ", xx[i]);
        }
      }
    } while (next_permutation(xx, xx + a) && summ < b);
  }
  return 0;
}
