main :: IO ()
main = do
    [_,k] <- map read . words <$> getLine :: IO [Int]
    array <- map read . words <$> getLine :: IO [Int]
    let ans = maximum $ map product $ comb k array
    print ans

comb :: Int -> [a] -> [[a]]
comb 0 _  = [[]]
comb _ [] = []
comb n (x:xs) = [x:y | y <- comb (n-1) xs] ++ comb n xs
