401681: GYM100513 F Ilya Muromets

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Ilya Murometstime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputСилачом слыву недаром — семерых одним ударом!From the Russian cartoon on the German fairy tale.

Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to n from left to right.

Making one sweep of sword Ilya Muromets can cut at most k contiguous heads of Zmej Gorynych. Thereafter heads collapse getting rid of empty space between heads. So in a moment before the second sweep all the heads form a contiguous sequence again.

As we all know, dragons can breathe fire. And so does Zmej Gorynych. Each his head has a firepower. The firepower of the i-th head is fi.

Ilya Muromets has time for at most two sword sweeps. The bogatyr wants to reduce dragon's firepower as much as possible. What is the maximum total firepower of heads which Ilya can cut with at most two sword sweeps?

Input

The first line contains a pair of integer numbers n and k (1 ≤ n, k ≤ 2·105) — the number of Gorynych's heads and the maximum number of heads Ilya can cut with a single sword sweep. The second line contains the sequence of integer numbers f1, f2, ..., fn (1 ≤ fi ≤ 2000), where fi is the firepower of the i-th head.

Output

Print the required maximum total head firepower that Ilya can cut.

ExamplesInput
8 2
1 3 3 1 2 3 11 1
Output
20
Input
4 100
10 20 30 40
Output
100

加入题单

算法标签: