K-th Smallest
Print the K-th smallest element (duplicates count separately).
Input: the first line has N and K; the second line has N integers.
Output: the K-th smallest value.
Constraints:
- 1 ≤ K ≤ N ≤ 105
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
5 2 7 1 5 1 9
Output 1
1
Input 2
1 1 4
Output 2
4
Discussion (opens after you solve — no spoilers before)
No comments yet.