#P9044. [PA 2021] Koszulki
[PA 2021] Koszulki
Problem Description
people take part in a contest, where the score of person is .
The organizers decide to give out at least gifts.
However, if and does not receive a gift but receives a gift, then will be unhappy.
The organizers want everyone to be satisfied. Find the minimum number of gifts that must be given out.
Input Format
The first line contains two integers .
The second line contains integers .
Output Format
One line containing one integer, which is the required value.
5 3
75 90 120 75 40
4
Hint
Explanation for Sample #1
The best plan is to give gifts to everyone except the last person.
Constraints
For of the testdata, , .
Translated by ChatGPT 5