var n, k: integer;
    a: array[0..100000] of integer;
    i: integer;
    x: integer;
    s, sminn: integer;
begin
readln(n);
for i := 0 to n do
    readln(a[i]);
readln(k);

s := 0;
for i := 1 to k - 1 do
     s := s + a[i];
sminn := s;
for i := 1 to n - k do
begin
    s := s - a[i];
    s := s + a[i + k - 1];
    if s < sminn then
        sminn := s;
end;
writeln(sminn)
end.