n,k=gets.split.map &:to_i
a=gets.split.map &:to_i
r=0
n.times do |i|
  r+=a[i] if a[i]>0
end
m=0
gp=0
gm=0
k.times do |j|
  if a[j]>=0
    gp+=a[j]
  else
    gm-=a[j]
  end
end
m=[gp.abs,gm.abs].max.abs
mi=0
(n-k+1).times do |i|
  gp=0
  gm=0
  k.times do |j|
    if a[i+j]>=0
      gp+=a[i+j]
    else
      gm-=a[i+j]
    end
  end
  if gp.abs<=m
    m=gp.abs
    mi=i
  end
  if gm.abs<=m
    m=gm.abs
    mi=i
  end
end
p r-m