AT_scpc2026_div3_c The Kth Smallest Number

Description

#### 表示言語 / / An infinite sequence $ (a_n) $ satisfies the following property. - For every positive integer $ i $ satisfying $ i>N $ , $ a_i $ is equal to the $ K $ -th element of $ a_{i-N},a_{i-N+1},\dots,a_{i-1} $ after these values are sorted in nondecreasing order. Once the values of $ a_1,\dots,a_N $ are determined, the values of $ a_{N+1},a_{N+2},\dots $ are uniquely determined. You are given the values of $ N $ , $ K $ , $ M $ and $ a_1,\dots,a_N $ . Find $ a_M $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ K $ $ M $ $ a_1 $ $ a_2 $ $ \dots $ $ a_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 Sorting $ [2,0,2,6,0,5,1,6] $ in nondecreasing order, we have $ [0,0,1,2,2,5,6,6] $ . Since $ K=6 $ , we have $ a_9=5 $ . ### Sample Explanation 2 --- ### Constraints - $ 1 \leq K \leq N \leq 300\,000 $ - $ 1 \leq M \leq 10^{18} $ - $ -10^9 \leq a_i \leq 10^9 $ - All input values are integers.