# -*- coding:utf-8 -*-

class Solution:
    def findKth(self, a, n, K):
        # write code here
        #先来个快速排序
        resArr = self.quickSort(a)
        #最后直接返回结果
        return resArr[n-K]
    def quickSort(self, arr):
        if len(arr)>=2:
            mid=arr[len(arr)//2]
            left = []
            right = []
            arr.remove(mid)
            for num in arr:
                if num>mid:
                    right.append(num)
                else:
                    left.append(num)
            return self.quickSort(left)+[mid]+self.quickSort(right)
        else:
            return arr