Imran also wants to know: if the players are lined up shortest to tallest, who stands at exactly the K-th position? Read N integers and integer K. Print the K-th smallest value (1-indexed).
Input
First line N K, second line N integers.
Output
The K-th smallest value.
Constraints
1 ≤ K ≤ N ≤ 10^5
Sample Input
5 3 7 2 9 4 1
Sample Output
4
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.