beecrowd | 2663

Phase

By Maratona de Programação da SBC – 2017 BR Brazil

Timelimit: 1

In some academic competitions, such as the Brazilian Computer Science Olympiad (OBI), a certain number of contestants qualify from one phase to the next, guaranteeing one of the available spots. However, this number is usually variable, because given a certain minimum number of classified contestants, it is common for there to be a tie for the last place. In this case, it is common for all the contestants tied for last place to qualify.

Your task is to help calculate the number of contestants that will qualify to the next round. You will be given a list of the contestants' scores and the minimum number of places for the next round, and you must decide how many contestants will actually qualify.

Input

The first line of the entry will contain an integer N, 1 ≤ ≤ 1000, representing the number of contestants. The second line will contain an integer K, 1 ≤ K ≤ N, indicating the minimum number of contestants that must qualify for the next round. Then N lines will each contain a number between 1 and 1000, inclusively, corresponding to a contestant's score.

Output

Your program should print one line, containing the number of qualifiers for the next phase.

Input Sample Output Sample

10

3

1

2

3

4

5

5

4

3

2

1

4

5

2

500

500

500

500

500

5