Kyriakos Grizzly wasn't satisfied enough with his previous parties so he decided to host an even bigger one, this time as a buffet! Kyriakos has invited guests over, with the guest initially receiving nutritious dishes of food. Once everyone arrives, they will start eating their food, which will be done in rounds.
In each round, each guest will eat exactly dish, thus decreasing all by . Afterwards, a waiter will come by, choose any guest and serve them dishes, thus increasing by . In order to make things fair, each guest must have at least dish available to eat in order for a round to proceed. Otherwise, no more rounds of food are eaten and the buffet ends. Since Kyriakos Grizzly wants the buffet to last as long as possible, help him determine the maximum number of rounds that could be done if the waiter chose optimally, or determine that the guests will never run out of food!
Constraints
Subtask 1 [40%]
Subtask 2 [60%]
No additional constraints.
Input Specification
The first line contains two integers and .
The next line contains space separated integers , the initial values of the array.
Output Specification
On one line, output the maximum number of rounds that can be done. If there is no limit on the number of rounds, output INF
instead.
Sample Input 1
3 2
2 1 2
Sample Output 1
2
Explanation for Sample Output 1
The initial number of dishes each guest has is . One possible ordering the waiter could follow is as follows:
Round 1: Choose . The number of dishes left is .
Round 2: Choose . The number of dishes left is . Since , the buffet ends.
Notice that if the waiter chose to serve guest for the first round, only round of food can be eaten.
Sample Input 2
3 4
1 2 3
Sample Output 2
INF
Sample Input 3
5 2
1 4 4 6 9
Sample Output 3
6
Comments