Problem hidden

NDS - Increasing numbers

Subham and Dewang both are playing with numbers. Subham gives Dewang an array of numbers and asks him to tell the minimum possible last number of an increasing sequence of length L.

Note: Check the sample I/O for more clarity.

Input

Input consists of number of test cases T. Each test case contains size of array i.e. N. Next line contains N space separated elements of array. Next line contains length of the increasing sequence i.e. L.

Constraints

1 ≤ T ≤ 100
0 ≤ N ≤ 106
0 ≤ a[i] ≤ 106

Output

You have to print the minimum possible last number of a sequence and if their is no increasing sequence of length L, then print "-1" without the quotes.

Example

Input:
1
7
9 7 2 5 4 11 12 
3

Output:
11

Explanation

In sample input, possible increasing sequences of length L = 3 are (9, 11, 12), (7, 11, 12), (2, 5, 11), (2, 4, 11), (2, 5, 12), (2, 4, 12), (2, 11, 12), (5, 11, 12), (4, 11, 12) and the minimum last number is 11 for the sequences (2, 5, 11) and (2, 4, 11). Hence, the answer is 11.

 


Adicionado por:Buttman
Data:2016-07-06
Tempo limite:0.100s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP GOSU JS-MONKEY PERL6 PY_NBC SCALA TCL
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.