Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Minimization

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou've got array *A*, consisting of *n* integers and a positive integer *k*. Array *A* is indexed by integers from 1 to *n*.

You need to permute the array elements so that value

Input

The first line contains two integers *n*, *k* (2 ≤ *n* ≤ 3·10^{5}, 1 ≤ *k* ≤ *min*(5000, *n* - 1)).

The second line contains *n* integers *A*[1], *A*[2], ..., *A*[*n*] ( - 10^{9} ≤ *A*[*i*] ≤ 10^{9}), separate by spaces — elements of the array *A*.

Output

Print the minimum possible value of the sum described in the statement.

Examples

Input

3 2

1 2 4

Output

1

Input

5 2

3 -5 3 -5 3

Output

0

Input

6 3

4 3 4 3 2 5

Output

3

Note

In the first test one of the optimal permutations is 1 4 2.

In the second test the initial order is optimal.

In the third test one of the optimal permutations is 2 3 4 4 3 5.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/23/2018 16:39:21 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|