0.4 Who Advances?
(RankList for this Question)
Score: 10pts
Time Limit: 2.00 sec
Here's the deal: in this contest, if a contestant scores as much as or higher than the person in the k-th spot, they move on to the next round. Of course, their score must be positive. We've got n participants in the mix (n ≥ k), and you've got their scores. Can you figure out how many of them are making it to the next round?

Constraints are provided in the Input format

Input Format
The first line consists of two integers, n and k (where 1 ≤ k ≤ n ≤ 50), separated by a single space.

The second line contains n space-separated integers: a1, a2, ..., an (where 0 ≤ ai ≤ 100), representing the scores of participants ranked from first to last. The sequence is non-increasing, meaning each score is greater than or equal to the subsequent score in the sequence.

Output Format
Output the number of participants who advance to the next round.

Example 1
8 5
10 9 8 7 7 7 5 5


In the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.

Example 2
4 2
0 0 0 0


In the second example nobody got a positive score.

Log In to solve the Question