A lot of frogs want to cross a river. A river is $w$ units width, but frogs can only jump $l$ units long, where $l < w$. Frogs can also jump on lengths shorter than $l$. 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 $a_i$ stones at the distance of $i$ 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?


-----Input-----

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

The second line contains $w - 1$ integers $a_1, a_2, \ldots, a_{w-1}$ ($0 \le a_i \le 10^4$), where $a_i$ is the number of stones at the distance $i$ from the bank the frogs are currently at.


-----Output-----

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


-----Examples-----
Input
10 5
0 0 1 0 2 0 0 1 0

Output
3

Input
10 3
1 1 1 1 2 1 1 1 1

Output
3



-----Note-----

In the first sample two frogs can use the different stones at the distance $5$, and one frog can use the stones at the distances $3$ and then $8$.

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

Difficulty: interview

Starter code:

Solutions:

w, l = [int(i) for i in input().split(' ')]
arr = [int(i) for i in input().split(' ')]

cummulative = [0 for i in range(len(arr) + 1)]
for i in range(len(arr)):
    cummulative[i+1] = cummulative[i] + arr[i]

min_cut = 1000000009

for i in range(w - l):
    cut = cummulative[i + l] - cummulative[i]
    if cut < min_cut:
        min_cut = cut

print(min_cut)


Q = [int(x) for x in input().split(' ')]
w = Q[0]
l = Q[1]
A = [int(x) for x in input().split(' ')]
B = [0 for i in range(w-1)]
i = 0
j = 0
for i in range(w-1):
	if i<l:
		B[i]=A[i]
	else:
		while j<i:
			if j<i-l:
				j=i-l
			t = min(A[i]-B[i],B[j])
			B[i]+=t
			B[j]-=t
			if B[j]==0:
				j+=1
			else:
				break
	#print(B)
#print(A)
#print(B)
print(sum(B[w-l-1:]))


w, l = list(map(int, input().split()))
j = list(map(int, input().split()))

ans = sum(j[0:l])
temp = ans

for i in range(1, w - l):
    temp += j[i + l - 1] - j[i - 1]
    ans = min(ans, temp)

print(ans)
    
    


w, l = list(map(int, input().split()))
a = list(map(int, input().split()))

r = 1e18
s = sum(a[:l])

for i in range(l, w-1):
    r = min(s, r)
    s += a[i]
    s -= a[i-l]

r = min(s, r)
print(r)



#!/usr/bin/env python3

[w, l] = list(map(int, input().strip().split()))
ais = list(map(int, input().strip().split()))

winais = [0 for _ in range(w - l)]
s = sum(ais[:l])
winais[0] = s
for i in range(w - l - 1):
	s += ais[i + l] - ais[i]
	winais[i + 1] = s

print(min(winais))


w, l = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 0
for i in range(l):
    s += a[i]
c = 10**20 + 1
for i in range(l, w-1):
    c = min(c, s)
    s = max(0, s + a[i] - a[i-l])
c = min(c, s)
print(c)

inf = 2000000000
w, l = list(map(int, input().split()))
aa = input().split()

a = [0 for i in range(w)]
dp = [0 for i in range(w+1)]
su = [0 for i in range(w+1)]

for i in range(1, w):
    a[i] = int(aa[i-1])

for i in range(1, w):
    if i <= l :
        dp[i] = a[i]
    else :
        dp[i] = min(a[i], su[i-1] - su[i-l-1])
    su[i] = su[i-1] + dp[i]
#    print(i, ' -- ', dp[i])
res = inf

for i in range(l, w):
    res = min(res, su[i] - su[i-l])

print(res)


import sys

w, l = [int(x) for x in input().split()]
use = [int(x) for x in input().split()]
m = sum(use[0:l])
s = m

for i in range(1, w-l):
    s = s - use[i-1] + use[i+l-1]
    if s < m: m = s

print(m)


'''
import sys

w, l = [int(x) for x in input().split()]
use = [int(x) for x in input().split()]
use.append(sys.maxsize)
count = [0] * (w + 1)
count[0] = 1

for i in range(1, w+1):
    count[i] = min(sum(count[max(i-l,0):i]), use[i-1])

print(count[-1])
'''


w, l = list(map(int, input().split()))
a = list(map(int, input().split()))

s = sum(a[:l])
r = s

for i in range(l, w-1):
    s += a[i]
    s -= a[i-l]
    r = min(s, r)

print(r)


def read_nums():
    return list(map(int, input().split()))

w, l = read_nums()
rocks = read_nums()

cur_sum = sum(rocks[0: l])
min_sum = cur_sum
for i in range(l, len(rocks)):
    cur_sum -= rocks[i - l]
    cur_sum += rocks[i]
    min_sum = min(min_sum, cur_sum)

print(min_sum)


l,w=list(map(int,input().split()))
li=list(map(int,input().split()))
aa=[]
tot=0
for i in range(l-1):
    tot+=li[i]
    if i>=w:
        tot=tot-li[i-w]
    if i>=(w-1):
        aa.append(tot)
print(min(aa))


input_string = input().split()
n = int(input_string[0])
l = int(input_string[1])
input_string = input().split()
v = []
for i in range(0, len(input_string)):
	v.append(int(input_string[i]))
dp = [0]
for i in range(1, len(v) + 1):
	dp.append(dp[i-1] + v[i-1])
ans = 1000000000000000000000000000
for i in range(l, len(dp)):
	ans = min(ans, dp[i] - dp[i - l])
print(ans)

w, l = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = res = sum(a[:l])
for i in range(l, w - 1):
    s += a[i] - a[i - l]
    res = min(res, s)
print(res)


import sys
while True:
	try:
		W, L = [int(i) for i in input().split()]
		river = [int(i) for i in input().split()]

		sum_seq = sum(river[:L])
		frogs = sum_seq

		for i in range(L,W-1):
			sum_seq = sum_seq + river[i] - river[i-L]
			frogs = min(sum_seq, frogs)
		print(frogs)
	except EOFError:
		return

w,l=list(map(int,input().split()))
a=list(map(int,input().split()))
s=sum(a[:l]);r=1000000000000000000
r=min(s,r)
for i in range(w-l-1):
    s+=a[i+l]
    s-=a[i]
    r=min(s,r)
print(r)


I=lambda:map(int,input().split())
w,l=I()
a=list(I())
c=s=sum(a[:l])
for i in range(w-l-1):
    s=s-a[i]+a[i+l]
    c=min(c,s)
print(c) 

n,k=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a[:k])
b=[]
c=0
b.append(s)
for i in range(n-k-1):
    s=s-a[i]+a[i+k]
    b.append(s)
print(min(b))

w, l = map(int, input().split())
a = list(map(int, input().split()))
f = s = sum(i for i in a[:l])
for i, b in enumerate(a[l:]):
    s += b - a[i]
    f = min(s, f)
print(f)

w,l = list(map(int,input().split()))
a = list(map(int,input().split()))
for i in range(1,w-1):
	a[i] = a[i] + a[i-1]
ans = a[l-1]
for i in range (l,w-1):
	ans = min(ans,a[i]-a[i-l])
print(ans)


from itertools import *
r=lambda:map(int,input().split())
w,l=r()
v=[0,*accumulate(r())]
print(min(v[i]-v[i-l] for i in range(l,w)))

from itertools import *
r=lambda:list(map(int,input().split()))
w,l=r()
v=[0,*accumulate(r())]
# print(w,l)
# print(v)
print(min(v[i]-v[i-l] for i in range(l,w)))


I=lambda:map(int,input().split())
w,l=I()
a=list(I())
c=s=sum(a[:l])
for i in range(w-l-1):
    s=s-a[i]+a[i+l]
    c=min(c,s)
print(c) 

# input segment
w,l = list(map(int,input().split()))
a=list(map(int,input().split()))

# computer minimal segemnt of length l, and a temp variable
minsegment=s=sum(a[:l])

# calculate every l segment min value,
for i in range(1,w-l):
    s=s-a[i-1]+a[i+l-1]
    minsegment = min(s,minsegment)

print(minsegment)


import sys

def findMinSubSum(a, l):
    minim = sum(a[:l])

    current = minim
    for i in range(l, len(a)):
        current += a[i] - a[i - l]
        minim = min(current, minim)

    return minim

w, l = map(int, input().split())
a = list(map(int, input().split()))
print(findMinSubSum(a, l))