Task
The managers of Gardaland Theme Park are building a new attraction, consisting of a sequence of chambers of horrors, each located at a different height of meters. Together with the attraction, they also plan to build a scenic walkway following most of the chambers from the outside.
In order to maximise the visibility of the new attraction, they need to carefully plan the altitude at which to build the walkway. For this reason they hired Giorgio and William, who calculated that it would be best if at least chambers were clearly visible from the walkway. Given a set of chambers, define its spread as the difference between the highest and the lowest chamber in the set. Find the smallest possible spread for a set of chambers!
Input data
The first line contains the two integers and . The second line contains integers .
Output data
You need to write a single line with an integer: the smallest possible spread for a set of chambers.
Constraints and clarifications
- .
- for each .
# | Points | Constraints |
---|---|---|
1 | 5 | Examples. |
2 | 30 | . |
3 | 25 | , . |
4 | 20 | . |
5 | 20 | No additional limitations. |
Example 1
stdin
6 2
50 60 80 40 10 80
stdout
0
Explanation
In the first sample case the set of chambers with lowest spread is .
Example 2
stdin
10 3
67 90 22 79 95 89 76 21 65 99
stdout
6
Explanation
In the second sample case the set of chambers with lowest spread is .