Competitive programming is awesome, but bartending can be a better way to make some extra cash.
Tonight you're bartending at the "Lonely Goose" bar at Waterloo, serving their signature "Lonely Goose"
cocktail. There are
Find out the quickest time in which you can achieve the desired drink allocation.
Input Specification
The first row contains two integers -
Output Specification
Output a single number - the smallest possible number of minutes to achieve the goal.
Sample Input 1
6 3
1 1 1 4 3 3
Sample Output 1
2
Explanation for Sample 1
In the first test, you can pour 1 millilitre into glasses 1-4, followed by pouring 3 millilitres into glasses 4-6.
Sample Input 2
5 5
4 0 4 0 4
Sample Output 2
12
Comments