438. Kth Largest Element in an Array

0

Medium

Given an array A of integers and an integer k, find and print the kth largest element in the array. Note that the kth largest element refers to its position in the sorted order, not the kth distinct element.

Input Format

The first line of input contains two space-separated integers N (the size of the array) and K. The second line contains N space-separated integers representing the elements of the array.

Output Format

Print the kth largest element of the array.

Example

Input

6 2 4 6 2 7 9 1

Output

7

Constraints

1 <= N <= 10^4 1 <= k <= N -10^5 <= Arr[i] <= 10^5
Loading...

View Submissions

Console