We’re preparing your current view and syncing the latest data.
You have k puzzles with different numbers of pieces. You want to distribute exactly n puzzles to n students such that the difference between the largest and smallest puzzle in the selected set is minimized. Determine this minimum possible difference.
The first line contains two integers n and k (1 ≤ n ≤ k ≤ 50), where n is the number of students and k is the number of puzzles. The next line contains k integers representing the number of pieces in each puzzle.
Print a single integer — the minimum possible difference between the number of pieces in the largest and smallest puzzles distributed to the students.
1 ≤ n ≤ k ≤ 50 Each puzzle's number of pieces is a positive integer not exceeding 10^9.
Example 1
Input
4 6 10 12 10 7 5 22
Output
5
Explanation
Selecting puzzles with pieces 7, 10, 10, and 12 results in a difference of 12 - 7 = 5, which is minimal.