output_description: Print the amount of change as an integer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: n, k = map(int, input().split())
  a = list(map(int, input().split()))
  mod = 10**9 + 7
  
  ps = []
  ns = []
  zs = []
  for i in range(n):
      if a[i] > 0:
          ps.append(a[i])
      elif a[i] < 0:
          ns.append(a[i])
      else:
          zs.append(a[i])
  
  if k == 1:
      print(max(a))
  elif len(ps) + len(ns) < k:
      print(0)
  elif len(ps) == 0:
      ans = 1
      if k % 2 == 0:
          ns = sorted(ns)
          for i in range(k):
              ans = ans * ns[i] % mod
      elif len(zs) > 0:
          print(0)
      else:
          ns = sorted(ns, reverse=True)
          for i in range(k):
              ans = ans * ns[i] % mod
      print(ans)
  else:
      ans = 1
      ps = sorted(ps, reverse=True)
      ns = sorted(ns)
      if k % 2 == 0:
          pp = []
          for i in range(0, min(k, len(ps)), 2):
              try:
                  pp.append(ps[i] * ps[i + 1])
              except:
                  pass
      else:
          pp = []
          ans = ps[0]
          for i in range(1, len(ps), 2):
              try:
                  pp.append(ps[i] * ps[i + 1])
              except:
                  pass
      np = []
      for i in range(0, len(ns), 2):
          try:
              np.append(ns[i] * ns[i + 1])
          except:
              pass
      pnp = sorted(pp + np, reverse=True)
      if len(pnp) >= k // 2:
          for i in range(k // 2):
              ans = ans * pnp[i] % mod
          print(ans)
      else:
          print(0)
  
problem_description: Statement
  
  We will buy a product for N yen (the currency of Japan) at a shop.
  
  If we use only 1000-yen bills to pay the price, how much change will we
  receive?
  
  Assume we use the minimum number of bills required.
samples: [{"input": "1900", "output": "100\n    \n\nWe will use two 1000-yen bills to pay the price and receive 100 yen in change.\n\n* * *"}, {"input": "3000", "output": "0\n    \n\nWe can pay the exact price."}]