You'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 

<image> became minimal possible. In particular, it is allowed not to change order of elements at all.

Input

The first line contains two integers n, k (2 ≤ n ≤ 3·105, 1 ≤ k ≤ min(5000, n - 1)). 

The second line contains n integers A[1], A[2], ..., A[n] ( - 109 ≤ A[i] ≤ 109), 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.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll inf = 1E17;
const ll mod = 1;
ll a[300010];
int n, k, chnk;
ll dp[5001][5001];
ll solve(int pos, int xtra, int l) {
  if (pos == 0) {
    if (xtra == 0) return 0;
    return inf;
  }
  ll &ret = dp[pos][xtra];
  if (ret != -1) return ret;
  ret = a[l + chnk - 1] - a[l] + solve(pos - 1, xtra, l + chnk);
  if (xtra)
    ret = min(ret, a[l + chnk] - a[l] + solve(pos - 1, xtra - 1, l + chnk + 1));
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  while (cin >> n >> k) {
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    memset(dp, -1, sizeof dp);
    chnk = n / k;
    cout << solve(k, n % k, 1) << endl;
  }
  return 0;
}
