n = int(input())
a = []
for i in range(n + 1):
    a.append(int(input()))
k = int(input())

sminn = 1000 * 1000000
for i in range(1, n + 1 - k + 1):
    s = 0
    for j in range(i, i + k - 1):
        s += a[j]
    sminn = min(sminn, s)
print(sminn)
    

