{-# LANGUAGE LambdaCase #-}
-- module AtCoderBeginnerContest124.D (main) where

import           Control.Exception (assert)
import           Data.List         (group, tails)

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine
  people <- map fromChar <$> getLine
  assert (length people == n) $
    print $ solve k people

data Person =
  Upright | Handstand
  deriving (Eq)

fromChar :: Char -> Person
fromChar '0' = Upright
fromChar '1' = Handstand
fromChar _   = undefined

data People = Uprights Int | Handstands Int

toPeople :: [Person] -> [People]
toPeople = map (\ps -> f (head ps) (length ps)) . group
  where
    f Upright n   = Uprights n
    f Handstand n = Handstands n

sumPeople :: [People] -> Int
sumPeople = sum . map (\case Uprights n -> n ; Handstands n -> n)

solve :: Int -> [Person] -> Int
solve k = maximum . map (sumPeople . takePeaple k) . tails . toPeople

-- 直立が k個になる +1 とる
takePeaple :: Int -> [People] -> [People]
takePeaple _ []                      = []
takePeaple 0 (p : _)                 = [p]
takePeaple k (p@(Uprights _)   : ps) = p : takePeaple (k - 1) ps
takePeaple k (p@(Handstands _) : ps) = p : takePeaple k ps
