首页 > 试题广场 >

subseq

[编程题]subseq

Kanade has an array a[1..n] , she define that an array b[1..m] is good if and only if it satisfy the following conditions:

  1. 1<=b[i]<=n

  2. b[i]<b[i+1] for every i between 1 and m-1

  3. a[b[i]] < a[b[i+1]] for every i between 1 and m-1

  4. m>0

Now you need to find the k-th smallest lexicographically good array.


输入描述:
The first line has two integer n,k

The second line has n integer a[i]


输出描述:
If there is no solution, just only output -1, else output two lines, the first line has an integer m, the second line has m integer b[i]
示例1

输入

3 2
1 2 3

输出

2
1 2
示例2

输入

3 1000000000
1 2 3

输出

-1

备注:
1<=n <= 5*10^5

1<=k<=10^(18)

1<=a[i]<=10^9

这道题你会答吗?花几分钟告诉大家答案吧!