#include<cstdio>
long long n,a[100001],k,sum,s,s2,ans;
long long abs(long long x){return x<0?0:x;}
long long max(long long x,long long y){return x<y?y:x;}
int main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;++i)scanf("%lld",a+i),sum+=abs(a[i]);
	for(int i=1;i<=k;++i)s=s+a[i],s2+=abs(a[i]);ans=sum+abs(s)-s2;
	for(int i=k+1;i<=n;++i)s=s-a[i-k]+a[i],s2=s2-abs(a[i-k])+abs(a[i]),ans=max(ans,sum+abs(s)-s2);
	printf("%lld\n",ans);
	return 0;
}