import Data.List
import qualified Data.Vector as V
f s i k m t= if 2*k+i>(length s) then m else f s (i+1) k (max m (if t==1 then (s V.! 2*k+1+i)-(s V.! i) else (s V.! 2*k+i)-(s V.! i))) (1-t)
main=do
 [n,k]<-map read.words<$>getLine
 t<-group<$>getLine
 let s=(V.fromList.scanl1 (+).map length) t
 print$f s (if (head.head)t=='1' then 2*k+1 else 2*k) k 0 (read[(head.head) t])