CSES - Houses and Schools
  • Time limit: 1.00 s
  • Memory limit: 512 MB

There are nn houses on a street, numbered 1,2,,n1,2,\dots,n. The distance of houses aa and bb is ab|a-b|. You know the number of children in each house.

Your task is to establish kk schools in such a way that each school is in some house. Then, each child goes to the nearest school. What is the minimum total walking distance of the children if you act optimally?

Input

The first input line has two integers nn and kk: the number of houses and the number of schools. The houses are numbered 1,2,n1,2\dots,n.

After this, there are nn integers c1,c2,,cnc_1,c_2,\dots,c_n: the number of children in each house.

Output

Print the minimum total distance.

Constraints

  • 1kn30001 \le k \le n \le 3000
  • 1ci1091 \le c_i \le 10^9

Example

Input:

6 2
2 7 1 4 6 4

Output:

11

Explanation: Houses 2 and 5 will have schools.