n,k = list(map(int, input().split())) a = list(map(int, input().split())) a.sort(reverse=True) count = 0 ans = 0 for i in a: if(i>=1 and count