#C10438. Minimum Processing Time

    ID: 39643 Type: Default 1000ms 256MiB

Minimum Processing Time

Minimum Processing Time

You are given a factory worker setup where a widget is assembled from P parts. Each part has a specific processing time given in a list T. Although there are W workers available, the assembly is performed in parallel so that each part is processed simultaneously. Therefore, the total processing time to complete one widget is determined by the part with the longest processing time.

In other words, if the processing times of the parts are given by \(T_1, T_2, \dots, T_P\), then the minimum total processing time is:

\(T_{total} = \max_{1 \leq i \leq P} T_i\)

Your task is to compute this value.

inputFormat

Input is read from standard input. The first line contains two space-separated integers, (W) and (P), where (W) indicates the number of workers and (P) indicates the number of parts. The second line contains (P) space-separated integers representing the processing times for each part.

outputFormat

Output a single integer representing the minimum total processing time required to assemble the widget (i.e. the maximum processing time in the list).## sample

4 3
8 5 3
8