N,K=map(int,input().split()) p=[0]*401 for n in map(int,input().split()): p[n]+=1 m=0 for n in p[::-1]: if m+n>K:break m+=n print(m)