#P965D. Single-use Stones

    ID: 4233 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>binary searchflowsgreedytwo pointers*1900

Single-use Stones

No submission language available for this problem.

Description

A lot of frogs want to cross a river. A river is ww units width, but frogs can only jump ll units long, where l<wl < w. Frogs can also jump on lengths shorter than ll. but can't jump longer. Hopefully, there are some stones in the river to help them.

The stones are located at integer distances from the banks. There are aia_i stones at the distance of ii units from the bank the frogs are currently at. Each stone can only be used once by one frog, after that it drowns in the water.

What is the maximum number of frogs that can cross the river, given that then can only jump on the stones?

The first line contains two integers ww and ll (1l<w1051 \le l < w \le 10^5) — the width of the river and the maximum length of a frog's jump.

The second line contains w1w - 1 integers a1,a2,,aw1a_1, a_2, \ldots, a_{w-1} (0ai1040 \le a_i \le 10^4), where aia_i is the number of stones at the distance ii from the bank the frogs are currently at.

Print a single integer — the maximum number of frogs that can cross the river.

Input

The first line contains two integers ww and ll (1l<w1051 \le l < w \le 10^5) — the width of the river and the maximum length of a frog's jump.

The second line contains w1w - 1 integers a1,a2,,aw1a_1, a_2, \ldots, a_{w-1} (0ai1040 \le a_i \le 10^4), where aia_i is the number of stones at the distance ii from the bank the frogs are currently at.

Output

Print a single integer — the maximum number of frogs that can cross the river.

Samples

Sample Input 1

10 5
0 0 1 0 2 0 0 1 0

Sample Output 1

3

Sample Input 2

10 3
1 1 1 1 2 1 1 1 1

Sample Output 2

3

Note

In the first sample two frogs can use the different stones at the distance 55, and one frog can use the stones at the distances 33 and then 88.

In the second sample although there are two stones at the distance 55, that does not help. The three paths are: 0369100 \to 3 \to 6 \to 9 \to 10, 0258100 \to 2 \to 5 \to 8 \to 10, 0147100 \to 1 \to 4 \to 7 \to 10.