f=lambda:map(int,input().split()) N,K=f() p=sorted(f())[::-1]+[-1]*400 m=p[K] print(len([1 for n in p if n>m]))