output_description: If Takahashi can calculate A \times B, print the result; if he cannot, print
  `-1`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B
attempt: N, K = input().split()
  N, K = [int(N), int(K)]
  A = list(map(int, input().split()))
  F = list(map(int, input().split()))
  
  A = sorted(A)
  F = sorted(F, reverse=True)
  time = list()
  
  for i in range(N):
      time.append(A[i] * F[i])
  
  goal_max = max(time)
  goal_min = 0
  goal_ave = int((goal_max + goal_min) / 2)
  goal = int((goal_max + goal_min) / 2)
  
  col = {"-1": "NG"}
  for i in range(goal_max + 1):
      col[str(i)] = None
  
  flag = True
  
  while flag:
      counter = 0
      print(goal)
      for i in range(N):
          counter += A[i] - int(goal / F[i])
  
      if counter <= K:
          if col[str(goal - 1)] == "NG":
              print(goal)
              flag = False
          else:
              col[str(goal)] = "OK"
              if goal == int((goal + goal_ave) / 2):
                  goal = int((goal + goal_ave) / 2) - 1
                  print("b")
              # elif goal!=goal_ave:
              #   goal=int((goal+goal_ave)/2)
              #   print("a")
              else:
                  goal = int((goal + goal_min) / 2)
                  print("c")
  
      elif counter > K:
          if col[str(goal + 1)] == "OK":
              print(goal + 1)
              flag = False
          else:
              col[str(goal)] = "NG"
              if goal == int((goal + goal_ave) / 2):
                  goal = int((goal + goal_ave) / 2) + 2
              # elif goal!=goal_ave:
              #   goal=int((goal+goal_ave)/2)
              else:
                  goal = int((goal + goal_max) / 2)
  
problem_description: Statement
  
  Having learned the multiplication table, Takahashi can multiply two integers
  between 1 and 9 (inclusive) together. He cannot do any other calculation.
  
  Given are two integers A and B.
  
  If Takahashi can calculate A \times B, print the result; if he cannot, print
  `-1` instead.
samples: [{"input": "2 5", "output": "10\n    \n\n2 \\times 5 = 10.\n\n* * *"}, {"input": "5 10", "output": "-1\n    \n\n5\\times 10 = 50, but Takahashi cannot do this calculation, so print `-1`\ninstead.\n\n* * *"}, {"input": "9 9", "output": "81"}]