parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,k = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	b = zeros(Int,n+1)
	c = zeros(Int,n+1)
	for i in 1:n
		b[i+1] = b[i] + a[i]
		c[i+1] = c[i] + max(a[i],0)
	end
	m = 0
	for i in 1:n-k+1
		m = max(m,b[i+k]-b[i]+c[n+1]-c[i+k]+c[i])
	end
	println(m)
end

main()