You own a Xerox shop and take pride in your time management skills. A customer arrives with N files to be printed, and each file
"files fil' indicates the time it takes to print. With your k printer machines, the objective is to create an optimal assignment, ensuring the minimum possible maximum working time among all machines.
The working time of any machine is defined as the sum of the time it takes to complete all files assigned to it. Your task is to devise an efficient strategy to allocate files to machines, aiming to minimize the maximum working time.
Input Format
• The First line of input contains an integer k.
• The Second line of input contains an integer n (length of files).
• The next n line of input contains an integer.
Constraints
・ 1x=k<=files.length <= 12
• 1 <= files[i] <= 10'
Output Format
• It will be an integer, which is the minimum possible maximum working time among all machines.
Input
2
5
2
4
7
8
Output
11
Explanation
As given k=2 (print machine), n=5, files = [1,2,4,7,81
print_machine 1 : files[0], files[l], files(4] = > 1+2+8 =11
print_machine '2' : files[2] + files [3]
=> 4+7 => 11
The minimum possible maximum working time among all machines is 11.