import java.util.*;
public class Solution {
public int findKth(int[] a, int n, int K) {
// write code here
int low=0;
int high=n-1;
QuickSort(a,low,high);
return a[n-K];
}
public void QuickSort(int R[],int low,int high){
int temp;
int i=low,j=high;
if(low<high)
{
temp=R[low];
while(i<j)
{
while(j>i&&R[j]>=temp)--j;
if(i<j)
{
R[i]=R[j];
++i;
}
while(i<j&&R[i]<temp)++i;
if(i<j)
{
R[j]=R[i];
--j;
}
}
R[i]=temp;
QuickSort(R,low,i-1);
QuickSort(R,i+1,high);
return;
}
}
}