{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C
import Data.Vector.Unboxed (Vector, (!))
import qualified Data.Vector.Unboxed as U
import Data.Vector.Unboxed.Mutable (unsafeRead, unsafeWrite)
import qualified Data.Vector.Unboxed.Mutable as UM

main :: IO ()
main = do
  [n, k] <- readInts
  s <- C.getLine
  print $ solve n k s

{-
000110100011110
K+1 個の 1 の塊をつなげられる
000 11 0 1 000 1111 0
K=1の時
000 11 0 1 [000] 1111 0
000 11 0 1 111 1111 0
が最大となる
連続する数字の数を次のように格納する
3 2 1 1 3 4 1
一番左が0の時は先頭に0を追加する
0 3 2 1 1 3 4 1
また後ろには0を追加する(最終的に奇数になっていれば不要だが常に追加してよい)
0 3 2 1 1 3 4 1 0
として、連続するK+2個が最大になるものを探していく
K=1なら
[0 3 2] 1 1 3 4 1
0 3 [2 1 1] 3 4 1
0 3 2 1 [1 3 4] 1
-}

solve n k s = getMax preProcess
  where
    getMax :: Vector Int -> Int
    getMax v = if (2 * k + 1) >= len then U.sum v else maximum $ getMaxSub 0 (U.sum $ U.take 2 v) firstK2Sum []
      where
        getMaxSub i p cnt xs =
          if (i + 2 * k + 2) >= len
            then (cnt:xs)
            else getMaxSub (i + 2) first2Sum (cnt - p + next2Sum) (cnt:xs)
          where
            next2Sum = (v U.! (i + 2 * k + 1) + v U.! (i + 2 * k + 2))
            first2Sum = (v U.! (i + 2) + v U.! (i + 3))
        firstK2Sum = U.sum $ U.take (2 * k + 1) v
    len = U.length preProcess
    preProcess :: Vector Int
    preProcess = U.fromList $ if C.index s 0 == '0'
      then preProcessSub 1 '0' 1 [0]
      else preProcessSub 1 '1' 1 []
    preProcessSub i prev cnt xs = if i >= n
      then reverse (0:cnt:xs)
      else if c == prev
        then preProcessSub (i + 1) prev (cnt + 1) xs
        else preProcessSub (i + 1) c 1 (cnt:xs)
      where
        c = C.index s i

vectest :: Vector Int -> Vector Int
vectest input = U.create $ do
  v <- UM.replicate 1000 0
  forM_ [0 .. 999] (\i -> do
    let e = input ! i
    unsafeWrite v i e
    )
  return v

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine