n,k = map(int,input().split()) an = list(filter(lambda x:x>0,sorted(list(map(int,input().split()))+[0])[::-1])) print(an[:k])