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: N, K = map(int, input().split())
  S = input()
  # print(N,K,S)
  # print(type(S[0]))
  
  
  def LINE_CHANGER(TIME, LENGTH, LINE):
      while True:
          if TIME == 0:
              return MAX_ONE
              break
          else:
              # print(TIME)
              LINE_LIST = list(LINE)
              # print(LINE_LIST)
  
              NOW = 0
              MAX_ONE = 0
              COUNTER = 0
              BEFORE = 0
              POINTER = 0
              LINE_ONE = 1
  
              if NOW < LENGTH:
                  while NOW < LENGTH - 1:
                      # print("LINECHECK",NOW,LINE_ONE)
                      # 初めの数が０の時の補正
                      if LINE[0] == "0" and NOW == 0 or COUNTER == 1:
                          # print("COUNTER = 1")
                          COUNTER = 1
                      else:
                          # print("COUNTER = 0")
                          COUNTER = 0
  
                      if COUNTER == 1 and LINE[NOW] == "0" and LINE[NOW + 1] == "1":
                          # print("BEFORECHECK")
                          BEFORE = NOW
                          # print("BEFORE=",BEFORE)
                          NOW += 1
                          LINE_ONE += 1
  
                      elif LINE[NOW] == "1" and LINE[NOW + 1] == "0":
                          COUNTER += 1
                          # print("COUNTER  +1",COUNTER)
  
                          if COUNTER == 2:
                              # print("COUNTER = 2")
                              if LINE_ONE > MAX_ONE:
                                  POINTER = NOW - LINE_ONE + 1
                                  MAX_ONE = LINE_ONE
                                  # print("CHANGE MAX_ONE",MAX_ONE,POINTER)
  
                              NOW = BEFORE + 1
                              LINE_ONE = 1
  
                          else:
                              NOW += 1
                              LINE_ONE += 1
                      else:
                          NOW += 1
                          LINE_ONE += 1
  
                  if LINE_ONE > MAX_ONE:
                      POINTER = NOW - LINE_ONE + 1
                      MAX_ONE = LINE_ONE
                      # print("CHANGE MAX_ONE",MAX_ONE,POINTER)
  
              # LINECHANGE
              # print("POINTER,MAX_ONE",POINTER,MAX_ONE)
              for i in range(POINTER, POINTER + MAX_ONE):
                  LINE_LIST[i] = "1"
  
              LINE = "".join(LINE_LIST)
              # print("LINECHANGE",LINE)
              TIME -= 1
  
  
  print(LINE_CHANGER(K, N, S))
  
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."}]