This Time is the coronavirus global pandemic. The number of coronavirus patients increases day to day in Italy. Story of ATK Hospital, ATK’s single deluxe room is designed to give enough space for mobility to the Covid 19 patient and accommodation for one attendant with attached bathing facilities. The ambience of the room is enhanced by the french windows that allow abundant natural light. To make you feel more at ease, our single deluxe rooms are additionally equipped with refrigerators, additional seating and a round table.
Daily N Number Covid 19 patients come to the hospital and it has M doctors each with expertise ‘K’. A doctor with a expertise K can help recover 1st patient in K seconds, 2nd patient in ‘2K’ seconds and Nth patient in ‘N*K’ seconds.
For example, if a doctor has expertise of 2(i.e, K=2), he will help recover the 1st patient in 2 seconds, 2nd patient in 4 seconds(2 * K) and 3rd patient in 6 seconds(3 * K) that means to help recover 3 patients he needs a total of 12 seconds. For the 4th patient he would need another(4 * K) seconds i.e 8 seconds, thus to help 4 patients recover the minimum time he would need would be 20 seconds and maximum time needed would be 29 seconds.
Find the minimum time needed by M doctors to make N Covid 19 patients healthy in ATK hospital.
Input Format
First line contains N, total Number of Covid 19 patients, In the next line the first integer denotes the number of doctors M, and M Integer follow in the Next line each denoting expertise value ( k) of doctor
Constraints
N <= 1000
M <= 50
1 <= K <= 8
Output Format
Print minimum time needed by M doctors to make N Covid 19 patients healthy in ATK hospital.
Sample Input
10
4
1 2 3 4
Sample Output
12
Explanation
First doctor with expertise 1, recover 4 patients in 10 sec (1+2+3+4).
Second doctor with expertise 2, recover 3 patients in 12 secs (2+4+6)
Third doctor with expertise 2, recover 2 patients in 9 sec (3+6)
Fourth doctor with expertise 4 , Only one patient left , they can do that in 4 sec
Since mutiple doctors can help recover patients simultaneously, the total time taken will be will be the maximum of the four doctors i.e. 12 sec