Sign Location
题号:NC15421
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

There are n stations on the road, which are located at x1 ... xn (x1 < x2 < ... < xn).

Your task is to choose k locations to put signs (signs could be put at anywhere, not necessary to be at a station). Let c(i,j) be the distance from the i-th station to the closest sign between station i and station j. c(i,j) = |xi - xj| if there's no sign between them. Find the optimal solution of the sign locations to minimize .

输入描述:

The input will consist of multiple test cases. Each case begins with two integers n and k. (0 ≤ k ≤ 200, 2 ≤ n ≤ 10000)

The following line contains n integers, x1 ... xn (0 ≤  x1 < x2 < ... < xn ≤ 107).

输出描述:

For each test case print one integer, the minimal value of .
示例1

输入

复制
4 0
1 2 3 4
4 1
1 2 3 4

输出

复制
20
11