n, k = map(int, input().split()) m = [int(i) for i in input().split()] assert 1 <= k < n <= 5*10**5 assert 1 <= min(m) and max(m) <= 10**9