/*
#include<stdio.h>
int main()
{
float a;
scanf("%f",&a);
if(a<=500)
{
printf("%d",(int)(a*0.7));
}
else if(a>500&&a<=1500)
{
printf("%d",(int)((a-500)*0.4+350));
}
else if(a>1500&&a<=4500)
{
printf("%d",(int)((a-1500)*0.15+750));
}
else if(a>4500&&a<=10000)
{
printf("%d",(int)((a-4500)*0.05+1200));
}
else
{
printf("%d",(int)((a-10000)*0.02+1475));
}
return 0;
}
*/
#include<stdio.h>
int main()
{
int n,k,d,i,max=-10000000,j,sum=0;
int h[100001]={};
scanf("%d %d",&n,&k);
d=k-1;
for(i=1;i<=n;i++)
{
scanf("%d",&h[i]);
}
for(i=1;i<=n;i++)
{
if(d==0)
{
if(h[i]>=max)
{
max=h[i];
}
}
else
{
sum+=h[i];
for(j=i+1;j<=i+d;j++)
{
sum+=h[j];
}
if(sum>max)
{
max=sum;
sum=0;
}
}
}
printf("%d",max);
return 0;
}