import Data.List (group)

main :: IO ()
main = do
  [n,k] <- map (read :: String -> Int) . words <$> getLine
  (m,bs) <- app . (\k -> (n,k)) <$> getLine
  print $ ans (2*k+1) (m,bs)

ans :: Int -> (Int, [Int]) -> Int
ans l (m,bs) = if l >= m then sum bs
               else let bs' = scanl (+) 0 bs
               in maximum $ map (\k -> (bs' !! (k+l)) - (bs' !! (k))) [0,2..m-l-4]

app :: (Int,String) -> (Int, [Int])
app (n,s)
  | head s == '0' && last s == '0' = (n+2, ((++ [0]) . (0:) . map length . group) s)
  | head s == '0' = (n+1, ((0:) . map length . group) s)
  | last s == '0' = (n+1, ((++ [0]) . map length . group) s)
  | otherwise = (n, (map length . group) s)