N,K,*p=map(int,open(0).read().split()) for i in range(401): t=sum(1for j in p if j>=i) if t<=K:exit(print(t))