LearnPy Hub
← Arena
EasyRating 800

Next Round

n contestants have scores in non-increasing order. Everyone with a positive score at least as high as the k-th place score advances. Count them.

Input

n k, then n scores.

Output

A count.

Sample 1

Input
8 5
10 9 8 7 7 7 5 5
Output
6

Sample 2

Input
4 2
0 0 0 0
Output
0
solution.py
Output appears here
Next Round · Python Arena problem · LearnPy Hub