#C6009. Minimized Maximum Processing Load

    ID: 49722 Type: Default 1000ms 256MiB

Minimized Maximum Processing Load

Minimized Maximum Processing Load

In this problem, you are given a list of file processing demands and a number of servers. Your task is to distribute the files among the servers so that the maximum load on any server is minimized. Formally, let ( files = [f_1, f_2, ..., f_n] ) be the file processing demands and ( S ) be the number of servers. You need to find the minimum integer ( L ) such that the files can be partitioned into ( S ) or fewer contiguous segments with the sum of each segment not exceeding ( L ).

inputFormat

The first line contains two integers: S (the number of servers) and N (the number of files).

The second line contains N positive integers separated by spaces representing the processing loads of the files.

outputFormat

Output a single integer representing the minimized maximum processing load when distributing the files among the servers.

## sample
3 5
10 20 30 40 50
60

</p>