output_description: Print the maximum possible number of consecutive people standing on hands
  after at most K directions.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      S
attempt: # create date: 2020-07-03 22:02
  
  import sys
  
  stdin = sys.stdin
  from itertools import groupby, accumulate
  
  
  def ns():
      return stdin.readline().rstrip()
  
  
  def ni():
      return int(ns())
  
  
  def na():
      return list(map(int, stdin.readline().split()))
  
  
  def main():
      n, k = na()
      s = ns()
      a = list()
      if s[0] == "0":
          a.append(0)
      gr = groupby(s)
      for key, group in gr:
          a.append(len(list(group)))
      if s[-1] == "0":
          a.append(0)
      acum = list(accumulate(a))
      m = len(acum)
      l = 2 * k + 1
      if m == 1:
          print(acum[0])
          quit()
      if l > m:
          print(acum[-1])
          quit()
      ans = acum[l - 1]
      for i in range(0, m - l + 1, 2):
          ans = max(ans, acum[i + l - 1] - acum[i - 1])
      print(ans)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  N people are arranged in a row from left to right.
  
  You are given a string S of length N consisting of `0` and `1`, and a positive
  integer K.
  
  The i-th person from the left is standing on feet if the i-th character of S
  is `0`, and standing on hands if that character is `1`.
  
  You will give the following direction at most K times (possibly zero):
  
  **Direction** : Choose integers l and r satisfying 1 \leq l \leq r \leq N, and
  flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1,
  ..., r, the i-th person from the left now stands on hands if he/she was
  standing on feet, and stands on feet if he/she was standing on hands.
  
  Find the maximum possible number of **consecutive** people standing on hands
  after at most K directions.
samples: [{"input": "5 1\n    00010", "output": "4\n    \n\nWe can have four consecutive people standing on hands, which is the maximum\nresult, by giving the following direction:\n\n  * Give the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\n* * *"}, {"input": "14 2\n    11101010110011", "output": "8\n    \n\n* * *"}, {"input": "1 1\n    1", "output": "1\n    \n\nNo directions are necessary."}]