output_description: Print the maximum number of coins you can get.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B
attempt: import sys
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST():
      return list(map(int, input().split()))
  
  
  sys.setrecursionlimit(10**9)
  INF = float("inf")
  MOD = 10**9 + 7
  
  N, K = LIST()
  S = input()
  
  # stand = []
  # reverse = []
  # state = None
  # count = 0
  # tmp = None
  # for i in S:
  # 	if i == "0":
  # 		state = "stand"
  # 	else:
  # 		state = "reverse"
  # 	if tmp == "stand" and state == "reverse":
  # 		stand.append(count)
  # 		count = 1
  # 	elif tmp == "reverse" and state == "stand":
  # 		reverse.append(count)
  # 		count = 1
  # 	else: # 状態が前と同じ
  # 		count += 1
  # 	tmp = state
  # if state == "stand":
  # 	stand.append(count)
  # else:
  # 	reverse.append(count)
  
  # if "0" not in S:
  # 	print(len(S))
  # else:
  # 	if K >= len(stand): # 全員逆立ちにできる
  # 		print(len(S))
  # 	else:
  # 		if len(stand) > len(reverse):
  # 			reverse.append(0)
  # 			reverse.insert(0, 0)
  # 		if len(stand) == len(reverse) and S[0] == "0":
  # 			reverse.insert(0, 0)
  # 		if len(stand) == len(reverse) and S[0] == "1":
  # 			reverse.append(0)
  # 		# print(stand)
  # 		# print(reverse)
  # 		max_ = 0
  # 		for i in range(max(1, 1+len(reverse)-(K+1))):
  # 			# print(reverse[i:i+K+1],stand[i:i+K])
  # 			tmp = sum(reverse[i:i+K+1]+stand[i:i+K])
  # 			if tmp > max_:
  # 				max_ = tmp
  # 		print(max_)
  
  indexes = []
  tmp = ""
  for i in range(len(S)):
      if S[i] == "0":
          state = "stand"
      else:
          state = "reverse"
      if tmp != state:
          indexes.append(i)
      else:  # 状態が前と同じ
          pass
      tmp = state
  indexes.append(N)
  ans = []
  # print(indexes)
  for i in range(len(indexes)):
      # print(i)
      if S[indexes[i]] == "0":
          if i + 2 * K >= len(indexes):
              pass
          ans.append(indexes[i + 2 * K] - indexes[i])
      else:
          if i + 2 * K + 1 >= len(indexes):
              pass
          ans.append(indexes[i + 2 * K + 1] - indexes[i])
  if ans == []:
      print(len(S))
  else:
      print(max(ans))
  
problem_description: Statement
  
  There are two buttons, one of size A and one of size B.
  
  When you press a button of size X, you get X coins and the size of that button
  decreases by 1.
  
  You will press a button twice. Here, you can press the same button twice, or
  press both buttons once.
  
  At most how many coins can you get?
samples: [{"input": "5 3", "output": "9\n    \n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this\nis the maximum result.\n\n* * *"}, {"input": "3 4", "output": "7\n    \n\n* * *"}, {"input": "6 6", "output": "12"}]