After extensively studying the finches from the Galápagos Islands, Charles Darwin has set his sights on the members of the genus Cancer. To that end, he's keeping several species of crab. Currently, he has crabs, which he has ordered in some way from to according to several characteristics, such as size, color, smell, etc. Furthermore, all crabs are at least a little aggressive, so each crab has aggressiveness , where is positive.
Darwin also owns aquariums, where he wants to keep his crabs, in order to observe them in their natural habitat. However, he's already spent a lot of time ordering the crabs by their characteristics, so he doesn't want to break the order too much. Therefore, he's decided to put the first crabs in the first aquarium, the next crabs in the second one, and so on until the last crabs - in the last aquarium. Obviously, and each is a non-negative integer, but other than that the values of all can be freely chosen by Darwin.
However, crabs have emotions too, and in particular - fear. In fact, they are quite afraid of each other, especially of the more aggressive ones. More concretely, crab is afraid of all other crabs kept in the same aquarium as , and that amount of fear towards each such crab is equal to its aggressiveness . Therefore, the total amount of fear crab feels is equal to the sum of all , where are the other crabs kept in the same aquarium as .
Darwin doesn't want to stress his crabs out too much though - each crab's individual feelings matter, after all. Thus, he's trying to minimize the total amount of fear they feel by choosing the best possible way to distribute them among the aquariums. However, back in the 30s (the 1830s that is) they didn't use to have such powerful computers, so Darwin asks you for help. Please assist him by writing a program which computes the minimum possible total amount of fear felt by the crabs when given , and all .
Input
From the first line of the standard input you should read two positive integers: and - the number of crabs and the number of aquariums. From the next line you should read positive integers: - the aggressiveness of each of the crabs, given according to Darwin's ordering.
Output
On the only line of the standard output you should print a single non-negative integer: the minimum possible total fear felt by the crabs.
Constraints
In order to get the points for a given subtask, your solution must pass all the tests for the subtask.
Subtask 1 (11 points)
Subtask 2 (8 points)
Subtask 3 (12 points)
Subtask 4 (24 points)
Subtask 5 (10 points)
Subtask 6 (35 points)
Example
stdin
8 4
8 1 2 3 9 1 9 1
stdout
32
Explanation
There are crabs that we have to keep in aquariums. The optimal distribution is: crab in aquarium ; crabs , and in aquarium ; crabs and in aquarium ; crabs and in aquarium . Crab feels no fear; crab feels fear; crab feels fear; crab feels fear; crab feels fear; crab feels fear; crab feels fear; crab feels fear. The total is .
stdin
6 3
10 3 8 5 4 7
stdout
37