#C9076. K-th Smallest Element
K-th Smallest Element
K-th Smallest Element
Given a list of distinct integers and an integer k, your task is to find the k-th smallest element in the list.
The k-th smallest element is defined as the element at index \( k \) (1-indexed) of the array when it is sorted in increasing order. In other words, if the array after sorting is \( arr[0], arr[1], \ldots, arr[n-1] \), then the answer is \( arr[k-1] \).
The input is provided via standard input and the answer must be printed to standard output.
inputFormat
The first line of input contains two integers: n
(the number of elements in the list) and k
(the position of the smallest element to find).
The second line contains n
space-separated integers representing the elements of the list.
Note: \( 1 \leq k \leq n \) and all the integers in the list are distinct.
outputFormat
Output the k-th smallest element as a single integer to standard output.
## sample6 3
7 10 4 3 20 15
7