#include <bits/stdc++.h>
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  int n, m;
  std::cin >> n >> m;
  std::vector<int> a(n);
  std::iota(std::begin(a), std::end(a), 1);
  std::map<int, std::vector<std::vector<int>>> map;
  int sp = 0;
  do {
    int s = 0;
    for (int i = 0; i < n; i++) {
      int m = 1000000000;
      for (int j = i; j < n; j++) {
        m = std::min(a[j], m);
        s += m;
      }
    }
    if (s >= sp)
      if (map[sp = s].size() < m) map[s].push_back(a);
  } while (std::next_permutation(std::begin(a), std::end(a)));
  for (const auto& i : map[sp].back()) std::cout << i << ' ';
  std::cout << std::endl;
  return 0;
}
