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