module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed           as V

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine :: IO [Int]
  s <- getLine
  let is = (\(x:xs) -> if x == 1 then x:xs else 0:x:xs) . nub $ delete (-2) (elemIndices '0' s) ++ [length s]
  print $ if head is == 0 then maximum $ g k 0 is else maximum $ f k 0 is
  where
    delete _ [] = []
    delete p (i:is) | (p + 1) == i = delete i is
                    | otherwise = (i + 1):delete i is

    f k i is | k > length is = [last is]
             | (i + k) >= length is = [last is]
             | otherwise = (is !! (i + k)) - (is !! i) : f k (i + 1) is

    g k i is | k > length is = [last is]
             | (i + k + 1) >= length is = [last is]
             | otherwise = (is !! (i + k + 1)) - (is !! i) : f k (i + 1) is
