- Time limit: 1.00 s
- Memory limit: 512 MB
A company employs programmers, who each have a skill level. Among them, it is desired to select pairs, where skill levels are close to each other.
When a pair of programmers with skill levels and is selected, a cost of is incurred. The total cost is the sum of this among all selected pairs.
Find the smallest possible total cost.
Input
The first line of input contains two integers and : the number of programmers and the desired number of pairs. It holds that .
The next line contains integers representing the skill levels of each programmer.
Output
Print one integer: the smallest possible total cost.
Example
Input:
8 3 3 1 2 7 9 3 4 7
Output:
1
Explanation: It is possible to choose pairs with skill levels , and .