import Control.Applicative
import Data.List

inputs = fmap (read :: String -> Int) . words <$> getLine
input = (read :: String -> Int) <$> getLine

main = do
    nm <- inputs
    let n = nm !! 0
    let m = nm !! 1
    if n /= 0 then
        do
            xs <- sequence [input | x <- [1..(n+m)]]
            let as = take n xs
            let bs = map ((-1) *) $ drop n xs
            let d  = sum as + sum bs
            let ans = filter (\x -> d == 2 * (sum x)) $ sequence [as, bs]
            if null ans then
                        print (-1)
                        else
                        putStrLn $ (\x -> (show $ x !! 0) ++ " " ++ (show $ -x !! 1)) $ head ans
            main
    else do return ()