import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as M




getBysplit = map read . words <$> getLine



count :: [String] -> [Int]
count lst = let
              xs = if (head . head) lst == '0' then [] : lst else lst
              ys = if (head . last) lst == '0' then xs ++ [] else xs
            in map length ys

solve :: Int -> M.Map Int Int -> Int -> Int
solve width mmap limit = foldl f 0 [0,2..limit]
      where
        f acc x = let
                    Just left = M.lookup x mmap
                    Just right = M.lookup (min (x + width) limit) mmap
                  in max (right - left) acc

main :: IO ()
main = do
  [n, k] <- getBysplit :: IO [Int]
  s <- getLine :: IO String
  let nums = (count . group) s --group 連続するものをリストに分割して二次元リストを返す
  let sums = scanl (+) 0 nums -- 累積和を作成する関数
  let width = 2 * k + 1
  let mmap = M.fromList $ zip [0..] sums
  print $ solve width mmap (length nums)
