N,K = map(int,input().split()) p=list(map(int,input().split())) p.sort() if N==K: print(K) elif p[-K-1]p[-K] for i in range(N)]))