You are given an array of integers that may contain duplicates. Consider only the set of distinct values that appear in the array. Sort those distinct values in strictly increasing order and report the value at position k (1-indexed) in that sorted order.
If the array contains fewer than k distinct values, print -1 instead.
Input format
Line 1: an integer n — the number of elements in the array.
Line 2: an integer k — the 1-indexed rank to report.
Line 3: n space-separated integers — the array elements.
Output format
A single line containing the k-th smallest distinct value, or -1 if fewer than k distinct values exist.
Constraints
- 1 ≤ n ≤ 100000
- 1 ≤ k ≤ 100000
- -1000000000 ≤ each value ≤ 1000000000