Next Round

Practice this coding question on Coding Gurukul.

Problem statement

A competition advances every participant with a positive score at least as large as the score in position k. Scores are already listed in nonincreasing order. Count all qualifying participants, including ties at the threshold.

Input format

First line: n k. Second line: n scores in nonincreasing order.

Output format

Print the number who advance.

Constraints

1 <= k <= n <= 50; 0 <= score <= 100.

Sample input

6 3
9 8 8 8 3 0

Sample output

4

Sign in to run or submit a solution in C++, Java or Python.