Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/saralash-k-chi-kichik

k-th smallest element

Easy 1000 ms 128 MB 27%
Share

$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.)

The sorted array; the number in the k-th place is highlighted

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

Sign in to submit a solution

Signing up is free and takes a minute.