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):
    for j in range(i, n + 2):
        if j - i == k - 1:
            s = 0
            for h in range(i, j):
                s += a[h]
            sminn = min(sminn, s)
print(sminn)
    

