# Depot 2

## Problem

There is a straight street going from west to east. There are n shops s1, s2, ..., sn, sorted in west to east order. The positioni pi of a shop si is specified by its distance (in meters) from the west end. s1 is at the west end, hence p1 = 0. No two shops have the same position and pi > 0 for all i > 1.

We will select k of the shop as a depot, where 1 ≤ k ≤ n. Goods are first transfered to all depots and then distributed to all other shops on the street. Assume si1, si2, ..., sik are selected as the depots. To distribute goods to sj, the cost is the distance between sj and its closet depot. The total cost of the distribution is the sum of cost over all shops. Notice that the cost of distributing goods to a depot si = |pi-pi| = 0.

This question requires you to find the minimum total cost of the distribution.

## Input

The input consists of a number of test cases. Each test case starts with two integer n and k on a single line. Then the second line contains n integers, corresponding to p1, p2, ..., pn. We have 1 ≤ n ≤ 200, 1 ≤ k ≤ 20, p1 = 0 and 1 ≤ p1 < p2 < ... < pn < 10,000. The last test case starts with an integer 0. Do not process it.

## Output

For each test case, print an integer corresponding to the minimum total cost of distribution.

```4 2
0 2 100 101
5 3
1 3 5 7 9
0
```

```3
4
```

Chan Ho Leung