import Data.List

main=do
  [n,k]<-map read.words<$>getLine :: IO [Int]
  s<-getLine
  print $ solve n k s

solve n k s = go ns (drop (2*k+1) ns) (sum $ take (2*k+1) ns)
  where
  go _ [] su = su
  go (n1:n2:ns) [m] su = max su (go ns [] new)
    where new = su-n1-n2+m
  go (n1:n2:ns) (m1:m2:ms) su = max su (go ns ms new)
    where new = su-n1-n2+m1+m2
  ns
    | head s == '0' = 0:cs
    | otherwise  = cs
    where cs = map length $ group s