{-# LANGUAGE TypeApplications #-}

-- | E - Multiplication 4
module Main where

import qualified Data.ByteString.Char8 as BS
import Data.List (sort, partition, sortOn)
import Data.Ord (Down(Down))
import Data.Bifunctor (Bifunctor(bimap))

main :: IO ()
main = do
  (n : k : _) <- map (read @Int) . words <$> getLine
  (ps, ns) <- bimap (sortOn Down) sort . partition (>= 0) . map (read . BS.unpack) . BS.words <$> BS.getLine
  let len = minimum [k, length ps, length ns]
  let patterns = if length ps < length ns then [(np, k - np) | np <- [0 .. len]] else [(k - nn, nn) | nn <- [0 .. len]]
  let ret = maxProduct (ps, ns) <$> patterns
  print $ (maximum ret) `mod` 1000000007
  where
    maxProduct :: Num a => ([a], [a]) -> (Int, Int) -> a
    maxProduct (ps, ns) (pn, nn) =
      let (p, n) = if even nn then (take pn ps, take nn ns) else (drop (length ps - pn) ps, drop (length ns - nn) ns)
      in product (p ++ n)
