Segments#5533

Segments

1 second
256 megabytes
Easy

Given segments, each with an integer length measured in centimeters, you must arrange these segments on a line so that the following conditions are satisfied:

Determine the smallest possible distance, in centimeters, between the leftmost and rightmost ends of the segments.

Input

The first line contains two integers and (1 \leq N \leq 50000). Each of the following lines contains the length of a segment (1 \leq L \leq 10^9).

Output

Print a single integer — the minimal possible distance between the ends of the segments.

Examples

Example 1

Loading
Loading