#include<stdio.h>
int a[100001];
int main(){
	freopen("c.in","r",stdin);
	int n,m;
	while(scanf("%d %d",&n,&m)!=EOF){
		for(int i=1;i<=n;i++){
			scanf("%d",&a[i]);
		}
		int sum=0,s=0;
		for(int i=1;i<=m;i++)sum+=a[i];
		s=sum;
		for(int i=2;i<=n-m+1;i++){
			s=s-a[i-1]+a[i+m-1];
			if(s>sum)sum=s;
		}
		printf("%d\n",sum);
	}
return 0;	
}