eolymp
Problems

Find an element

Find an element

Array of n integers is given. Find its k-th element in decreasing order.

Input

First line contains the number of elements n (1n105) in array, and integer k(1k105). Second line contains n integers, not greater than 109 by absolute value.

Output

Print the k-th element of array sorted in decreasing order, or -1 if such element does not exist.

Time limit 3 seconds
Memory limit 128 MiB
Input example #1
10 3
1 8 2 1 4 7 3 2 3 6
Output example #1
6
Source 2-й этап Всеукраинской олимпиады по информатике 2013-2014 уч.г. 10 кл. г. Бердичев