import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	int n, k;
	while (readf (" %s %s", &n, &k) > 0)
	{
		readln;
		auto a = readln.split.map !(to !(long)).array;
		long [] s = [0L];
		foreach (c; a)
		{
			s ~= s.back + c;
		}

		long cur = long.min / 4;
		int start = k;
		foreach (i; k..n + 1)
		{
			if (cur < s[i] - s[i - k])
			{
				cur = s[i] - s[i - k];
				start = k;
			}
		}

		foreach (i; 0..n)
		{
			if (i < start || start + k <= i)
			{
				cur += max (0, a[i]);
			}
		}

		writeln (max (0L, cur));
	}
}
