f=lambda:map(int,input().split()) n,k=f() *a,=f() b=sorted(list(set(a)))[::-1] m=0 for i in b: s=[t for t in a if t>=i] if len(s)>k: print(m) break else: m=len(s) else: print(n)