Score : $700$ points
You run a shop employing $N$ employees. Each employee comes to work in a fixed cycle. More specifically, starting today, the $i$-th employee repeats the following: working for $A_i$ consecutive days and then taking $A_i$ consecutive days off.
Every day starting today, you will come to work and give a medal to an employee of your choice who comes to work that day. (If no employee comes to work, you will do nothing that day.)
At least how many days does it takes to give every employee $K$ or more medals?
Input is given from Standard Input in the following format:
$N$ $K$ $A_1$ $A_2$ $\cdots$ $A_N$
Print the answer.
3 3 1 2 3
10
For example, you can choose to give them medals as follows:
Since no employee comes to work on the $4$-th day, this is one of the ways to achieve the objective in the minimum number of days.
10 10 1 1 1 1 1 1 1 1 1 1
199
2 5 1234 5678
10