def next_round(scores,base_index):
count =0
for e in scores:
if e >= scores[base_index-1] and e != 0:
count = count + 1
return count
if __name__ == '__main__':
total,base_index = list(map(int,input().split()))
scores = list(map(int,input().split()))
print(next_round(scores,base_index))