(defn abc124-D [S K]
  (let [{:keys [last-c xs]}
        (loop [e (first S)
               [c & r] S
               [n & acc0 :as acc] [0]]
          (if (not c)
            {:xs acc :last-c e}
            (if (= e c)
              (recur e r (cons (inc n) acc0))
              (recur c r (cons 1 acc)))))
        xs (if (= \1 last-c) xs (cons 0 xs))
        xs (reverse xs)
        xs (if (= \1 (first S)) xs (cons 0 xs))
        humps (/ (dec (count xs)) 2)]
    (if (>= K humps)
      (count S)
      (let [subsums (reduce
                      (fn [[sum acc] x]
                        (let [sum (+ sum x)] [sum (conj acc sum)]))
                      [0 [0]]
                      xs)
            [_ subsums] subsums
            windows (for [a (range 0 (- (count subsums)
                                        (* 2 K)) 2)]
                      [a (+ a (* 2 K))])
            cands (map (fn [[a b]] (- (nth subsums (inc b))
                                      (nth subsums a))) windows)]
        (reduce max cands)))))
(defn main-abc124-D []
  (let [_ (read) K (read)
        _ (read-line)
        S (read-line)]
    (println (abc124-D S K))))
(main-abc124-D)