#include<stdio.h>

int main(){
  int n,k,i,max=0,val;
int sumArray[1000003];

scanf("%d %d",&n,&k);

for(i=0;i<n;i++){
  scanf("%d",&val);
    if(i == 0)sumArray[i]=val;
    else sumArray[i]=sumArray[i-1]+val;
}

max = sumArray[k-1];
for(i=k;i<n;i++){
  if(sumArray[i]-sumArray[i-k] > max)max=sumArray[i]-sumArray[i-k];
}

 printf("%d\n",max);
return 0;
}