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