main :: IO ()
main = do
  [n,k] <- map (read :: String -> Int) . words <$> getLine
  bs <- app <$> getLine
  print $ ans (2*k+1) bs

ans :: Int -> (Int, [Int]) -> Int
ans k (n,bs) = if k > n then head bs
               else maximum $ map (\l -> (bs !! l) - (bs !! (l+k))) [0,2..n-k]

app :: String -> (Int, [Int])
app bs = finfunc $ foldl func ('1',0,1,[0]) bs where
  finfunc (c,n,l,ns) = if c == '0' then (l+2,n:n:ns) else (l+1,n:ns)
  func (c,n,l,ns) k
    | c == k = (c,n+1,l,ns)
    | c /= k = (k,n+1,l+1,n:ns)