N,K=map(int,input().split()) A=sorted(map(int,input().split()),reverse=True) MIN=min(A) ANS=0 for i in range(1<