题目描述
Problem Description
Takahashi has a sequence \( A \) of length \( N \). He decided to play around by finding the longest increasing subsequence (LIS) of \( A \). The longest increasing subsequence of \( A \) is a subsequence of \( A \) that is strictly increasing and has the maximum length. Takahashi found it boring to just find the LIS, so he decided to find the \( K \)-th lexicographical LIS of \( A \). Note that subsequences that are the same as sequences are not distinguished even if they are extracted from different positions.
However, Takahashi got tired and fell asleep. Write a program that, on behalf of Takahashi, finds and outputs the \( K \)-th lexicographical LIS of \( A \). If such a subsequence does not exist, output None.
Input Format
The input is given from the standard input in the following format:
\( N \) \( K \) \( A_1 \) \( A_2 \) \( ... \) \( A_N \)
Output Format
Output the \( K \)-th lexicographical LIS of \( A \) with spaces as delimiters. If such a subsequence does not exist, output None.
Sample Input and Output
Sample Input #1
6 2
3 6 5 1 2 7
Sample Output #1
3 5 7
Sample Input #2
4 2
1 1 2 2
Sample Output #2
None
Sample Input #3
20 1000
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19
Sample Output #3
2 4 6 8 10 11 13 16 18 20
Notes/Hints
Constraints
- All inputs are integers.
- \( 1 \leq N \leq 300,000 \)
- \( 1 \leq K \leq 10^{18} \)
- \( 1 \leq A_i \leq 10^9 \)
Sample Explanation 1
The longest increasing subsequences of \( A \) are as follows:
- \( [1,2,7] \)
- \( [3,5,7] \)
- \( [3,6,7] \)
The 2nd lexicographical subsequence is \( [3,5,7] \).
Sample Explanation 2
The longest increasing subsequence of \( A \) is only \( [1,2] \), so output None.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分