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: while True:
  
      N, k = map(int, input().split())
      S = input()
      lenth = 0
      AllLen = []
      preS0, preS1 = S.split("1"), S.split("0")
      S0 = [i for i in preS0 if i != ""]
      S1 = [i for i in preS1 if i != ""]
      num0 = k
      if len(S0) <= k:
          print(len(S))
          break
      if S[0] == "0":
          J = k
      else:
          J = k + 1
      FirstLen = sum([len(S0[i]) for i in range(k)]) + sum([len(S1[j]) for j in range(J)])
      AllLen.append(FirstLen)
      CheckLen = FirstLen
      if S[0] == "1" and S[-1] == "1":
          for i in range(len(S0) - k):
              CheckLen = (
                  CheckLen - len(S0[i]) - len(S1[i]) + len(S0[i + k]) + len(S1[i + k + 1])
              )
              AllLen.append(CheckLen)
      if S[0] == "0" and S[-1] == "1":
          CheckLen = CheckLen - len(S0[0]) + len(S0[k]) + len(S1[k])
          AllLen.append(CheckLen)
          for i in range(len(S0) - k - 1):
              CheckLen = (
                  CheckLen
                  - len(S0[i + 1])
                  - len(S1[i + 1])
                  + len(S0[i + k + 1])
                  + len(S1[i + k + 1])
              )
              AllLen.append(CheckLen)
      if S[0] == "1" and S[-1] == "0":
          for i in range(len(S0) - k - 1):
              CheckLen = (
                  CheckLen - len(S0[i]) - len(S1[i]) + len(S0[i + k]) + len(S1[i + k + 1])
              )
              AllLen.append(CheckLen)
          CheckLen = (
              CheckLen
              - len(S0[len(S0) - k - 1])
              - len(S1[len(S0) - k - 1])
              + len(S0[len(S0) - 1])
          )
          AllLen.append(CheckLen)
      if S[0] == "0" and S[-1] == "0":
          if len(S1) == 1:
              print(len(max(S0)) + len(S1[0]))
              exit()
          CheckLen = CheckLen - len(S0[0]) + len(S0[k]) + len(S1[k])
          AllLen.append(CheckLen)
          for i in range(len(S0) - k - 2):
              CheckLen = (
                  CheckLen
                  - len(S0[i + 1])
                  - len(S1[i + 1])
                  + len(S0[i + k + 1])
                  + len(S1[i + k + 1])
              )
              AllLen.append(CheckLen)
          CheckLen = (
              CheckLen
              - len(S0[len(S0) - k - 1])
              - len(S1[len(S0) - k - 1])
              + len(S0[len(S0) - 1])
          )
          AllLen.append(CheckLen)
      print(max(AllLen))
      break
  
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."}]