output_description: Print the maximum product modulo (10^9+7), using an integer between 0 and
  10^9+6 (inclusive).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      A_1 \ldots A_N
attempt: n, k = map(int, input().split())
  ps = []
  ns = []
  zs = 0
  for a in map(int, input().split()):
      if a > 0:
          ps.append(a)
      elif a < 0:
          ns.append(a)
      else:
          zs += 1
  
  
  def product(l):
      t = 1
      for li in l:
          t *= li
      return t
  
  
  def p(x):
      print(x % (10**9 + 7))
  
  
  if len(ps) + len(ns) == 0:
      print(0)
  elif len(ps) == 0:
      if k % 2 == 0:
          ns.sort()
      else:
          ns.sort(reverse=True)
      p(product(ns[:k]))
  elif len(ns) == 0:
      ps.sort(reverse=True)
      p(product(ps[:k]))
  else:
      ma = 0
      l = ps + ns
      pn = []
      for i in range(len(l)):
          pn.append(l[i] > 0)
          l[i] = abs(l[i])
      tmp = sorted(list(zip(*[l, pn])), key=lambda x: x[0], reverse=True)
      l = list(map(lambda x: x[0], tmp))
      pn = list(map(lambda x: x[1], tmp))
      if len([pni for pni in pn[:k] if not pni]) % 2 == 0:
          p(product(l[:k]))
      else:
          i = len(pn) - 1 - pn[::-1].index(False)
          j = pn.index(True, k)
          l = l[:k] + l[j]
          l.pop(i)
          p(product(l[:k]))
  
problem_description: Statement
  
  Given are N integers A_1,\ldots,A_N.
  
  We will choose exactly K of these elements. Find the maximum possible product
  of the chosen elements.
  
  Then, print the maximum product modulo (10^9+7), using an integer between 0
  and 10^9+6 (inclusive).
samples: [{"input": "4 2\n    1 2 -3 -4", "output": "12\n    \n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and\n12, so the maximum product is 12.\n\n* * *"}, {"input": "4 3\n    -1 -2 -3 -4", "output": "1000000001\n    \n\nThe possible products of the three chosen elements are -24, -12, -8, and -6,\nso the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\n* * *"}, {"input": "2 1\n    -1 1000000000", "output": "1000000000\n    \n\nThe possible products of the one chosen element are -1 and 1000000000, so the\nmaximum product is 1000000000.\n\n* * *"}, {"input": "10 10\n    1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1", "output": "999983200\n    \n\nBe sure to print the product modulo (10^9+7)."}]