var
n,k:integer;
a:array[1..1000] of integer;
s:array[1..1000] of longint;
i,j:integer;
max:longint;
begin
readln(n,k);
for i:=1 to n do read(a[i]);
for i:=1 to n do s[i]:=0;
for i:=1 to n-k+1 do for j:=1 to k do s[i]:=s[i]+a[i+j-1];
max:=s[1];
for i:=2 to n-k+1 do if s[i]>max then max:=s[i];
writeln(max);
end.