import Control.Monad
import Data.Int

fn :: (Int64, Int64) -> Int64 -> Maybe (Int64, Int64)
fn (a, b) m
    | a > b = Nothing
    | otherwise = Just (m * ( (a + m - 1) `div` m), m * (b `div` m) + m - 1)

main = do
  getLine
  a <- fmap (reverse . (1:) . fmap read . words) getLine
  putStrLn $ case foldM fn (2, 2) a of
    Nothing -> "-1"
    Just (x, y) -> unwords $ [show x, show y]
