import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n, k;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		n = tmp[0], k = tmp[1];
		}
	long[] as = readln.chomp.split.map!(to!long).array;
	
	long[] bs = as.map!(x => (x > 0)? 0: x).array;
	
	BigInt x = bs[0 .. k].reduce!("a + b");
	BigInt xmax = x;
	int imax = 0;
	for(int i = 1; i + k <= n; i ++){
		x -= bs[i - 1];
		x += bs[i + k - 1];
		if(x > xmax){
			xmax = x;
			imax = i;
			}
		debug writeln(x, " ", xmax);
		}
	
	BigInt ans;
	for(int i = 0; i < n; i ++){
		if(i < imax || imax + k <= i){
			if(as[i] > 0) ans += as[i];
			debug writeln(as[i], as[i] > 0);
			}
		else{
			ans += as[i];
			debug writeln(as[i], " *");
			}
		}
	
	ans.writeln;
	}