It is the night after Christmas, and there are
There might not be enough candies to make all the reindeer happy, but can you help Santa figure out the maximum number of reindeer he can satisfy by distributing the
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line contains two space-separated integers,
The next
Output Specification
Output one integer, the maximum number of reindeer Santa can satisfy.
Sample Input 1
5 3
1
1
1
1
1
Sample Output 1
3
Explanation for Sample Output 1
Since there are only
Sample Input 2
5 10
3
2
5
1
6
Sample Output 2
3
Explanation for Sample Output 2
If Santa gives candies to the 1st, 2nd, and 4th reindeer, he uses up a total of
Hence, the maximum number of reindeer that can be satisfied is
Comments