~/algor $ cat problems/saralash-k-chi-kichik
k-th smallest element
Easy
1000 ms
128 MB
27%
$n$ integers and a positive integer $k$ are given. Which number is in the $k$-th place when the numbers are sorted in increasing order? (Each of the equal numbers takes a separate place.)
Input
The first line contains two positive integers: $n$ and $k$. The second line contains $n$ integers $a_{i}$.
Output
One integer — the $k$-th element of the sorted array.
Note
$1 \le k \le n \le 2 \cdot 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
6 3 7 2 9 2 5 1
Output #1
2
Input #2
1 1 -5
Output #2
-5