NutanixOA #6
Number of Players (for MTS2)
估计简单可在线判题
Count the players who can level up under competition ranking: players with the same score share the same rank, and the rank of the next distinct score equals its position in the sorted order; players with a score of 0 never level up.
The standard input/output format and any supplementary ranges on this site are as defined in this problem statement.
输入格式
The first line contains n k (1≤n≤100000, 1≤k≤n), and the next line contains n scores (0≤score≤100).
输出格式
Output the number of players whose rank does not exceed k and whose score is greater than 0.
样例 1
输入:
4 3
100 50 50 25
输出:
3
样例 2
输入:
5 4
20 40 60 80 100
输出:
4
样例 3
输入:
5 4
2 2 3 4 5
输出:
5