import Data.Char
import Data.List
main=do
 [_,k]<-map read.words<$>getLine
 sn<-map digitToInt<$>getLine
 let s=group sn
     sl=length s
 print$maximum$map length$(concat(take (2*k) s)):[concat(take (2*k+1) (drop (if head(head s)==0 then x*2+1 else x*2) s))|x<-[0..sl`div`2]]