#abc218h. [abc218_h]Red and Blue Lamps

[abc218_h]Red and Blue Lamps

Problem Statement

There are NN lamps numbered 11 through NN arranged in a row. You are going to light RR of them in red and NRN-R in blue.

For each i=1,ldots,N1i=1,\\ldots,N-1, a reward of AiA_i is given if Lamp ii and Lamp i+1i+1 light up in different colors.

Find the maximum total reward that can be obtained by efficiently deciding the colors of the lamps.

Constraints

  • 2leqNleq2times1052 \\leq N \\leq 2\\times 10^5
  • 1leqRleqN11 \\leq R \\leq N-1
  • 1leqAileq1091 \\leq A_i \\leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN RR A1A_1 A2A_2 ldots\\ldots AN1A_{N-1}

Output

Print the answer.


Sample Input 1

6 2
3 1 4 1 5

Sample Output 1

11

Lighting up Lamps 3,53, 5 in red and Lamps 1,2,4,61, 2, 4, 6 in blue yields a total reward of A2+A3+A4+A5=11A_2+A_3+A_4+A_5=11.

You cannot get any more, so the answer is 1111.


Sample Input 2

7 6
2 7 1 8 2 8

Sample Output 2

10

Lighting up Lamps 1,2,3,4,5,71, 2, 3, 4, 5, 7 in red and Lamp 66 in blue yields a total reward of A5+A6=10A_5+A_6=10.


Sample Input 3

11 7
12345 678 90123 45678901 234567 89012 3456 78901 23456 7890

Sample Output 3

46207983