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: n, k = map(int, input().split())
  s = input()
  s_list = []
  first = s[0]
  last = s[n - 1]
  state = first
  length = 1
  for i in range(1, n):
      if (state == "0" and s[i] == "0") or (state == "1" and s[i] == "1"):
          state = s[i]
          length = length + 1
      else:
          state = s[i]
          s_list.append(length)
          length = 1
  s_list.append(length)
  if first == "0":
      if last == "0":
          number0 = (len(s_list) + 1) / 2
      else:
          number0 = len(s_list) / 2
  else:
      if last == "0":
          number0 = len(s_list) / 2
      else:
          number0 = (len(s_list) - 1) / 2
  if first == "0" and last == "0":
      if number0 <= k:
          Max = n
      else:
          p_list = s_list[0 : 2 * k]
          Max = sum(p_list)
          i = 1
          while i + 2 * k + 1 < n - 1:
              p_list = s_list[i : i + 2 * k + 1]
              if sum(p_list) > Max:
                  Max = sum(p_list)
              i = i + 2
          p_list = s_list[n - 2 * k :]
          if sum(p_list) > Max:
              Max = sum(p_list)
  elif first == "0" and last == "1":
      if number0 <= k:
          Max = n
      else:
          p_list = s_list[0 : 2 * k]
          Max = sum(p_list)
          i = 1
          while i + 2 * k + 1 <= n - 1:
              p_list = s_list[i : i + 2 * k + 1]
              if sum(p_list) > Max:
                  Max = sum(p_list)
              i = i + 2
  elif first == "1" and last == "0":
      if number0 <= k:
          Max = n
      else:
          p_list = s_list[0 : 2 * k + 1]
          Max = sum(p_list)
          i = 2
          while i + 2 * k + 1 < n - 1:
              p_list = s_list[i : i + 2 * k + 1]
              if sum(p_list) > Max:
                  Max = sum(p_list)
              i = i + 2
          p_list = s_list[n - 2 * k :]
          if sum(p_list) > Max:
              Max = sum(p_list)
  elif first == "1" and last == "1":
      if number0 <= k:
          Max = n
      else:
          p_list = s_list[0 : 2 * k + 1]
          Max = sum(p_list)
          i = 2
          while i + 2 * k + 1 <= n - 1:
              p_list = s_list[i : i + 2 * k + 1]
              if sum(p_list) > Max:
                  Max = sum(p_list)
              i = i + 2
  print(Max)
  
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"}]