N, K = gets.split.map &:to_i
S = gets.chomp.chars.map &:to_i

A = S.chunk{|s| s < 1}.map{|_, a|
  a.size * (a[0] == 0 ? -1 : 1)
}
A.unshift(0) if A[0] < 0
A.push(0) if A[-1] < 0

l = r = 0
cnt = 0
ans = curr = A[r]
loop{
  r += 2
  break if r >= A.size
  curr += A[r-1].abs + A[r].abs
  ans = curr if curr > ans
  cnt += 1
  if cnt >= K
    cnt -= 1
    l += 2
    curr -= A[l-1].abs + A[l-2].abs
  end
}
p ans
