LearnPy Hub
← Arena
IntermediateRating 1200

Fair Packets

Give one packet to each of m children. Choose the packets so the difference between the largest and smallest chosen packet is as small as possible. Print that difference.

Input

n and m, then n packet sizes.

Output

One integer.

Sample 1

Input
7 3
7 3 2 4 9 12 56
Output
2

Sample 2

Input
3 1
5 5 9
Output
0
solution.py
Output appears here
Fair Packets · Python Arena problem · LearnPy Hub