G Bad Tree
题号:NC223928
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

输入描述:

There is only one input line; it contains two space separated integers: n (1 ≤ n ≤ 100), representing the number of nodes in the binary search tree, andk(1 ≤k≤ 1018), where we desire thekth lexicographical permutation of the first  nintegers which creates  a binary  search tree of height  n– 1, when inserted in the order given in the permutation.


输出描述:

Print thekth lexicographical permutation of the integers 1 throughnof the permutations which, when the values are inserted into a binary search tree, create a tree of heightn– 1. Output the permutation on a single line, following each number in the permutation with a space. If no such permutation exists, output –1 instead.

示例1

输入

复制
5 12

输出

复制
5 1 4 3 2
示例2

输入

复制
4 2

输出

复制
1 2 4 3
示例3

输入

复制
6 1

输出

复制
1 2 3 4 5 6
示例4

输入

复制
3 50

输出

复制
-1