Reduce the array#11719

Reduce the array

1 second
1,228 megabytes
Medium

Given an array of integers and an integer . Find the minimum cost to reduce the array to a single element. You can perform the following operation any number of times:

Input

The first line contains two integers and k~(n, k \le 100). The second line contains integers a_1, a_2, \ldots, a_n~(0 \le a_i \le 100).

Output

Print the minimum cost to reduce the array to a single element.

Examples

Example 2

Loading
Loading

Example 1

Loading
Loading