import Data.List

main = interact $ unlines . map (show' . uncurry equal_total_scores) . read' . lines
 where
  read' ("0 0":_) = []
  read' (nm:xs) = splitAt n (map read th) : read' xs'
   where
    [n,m] = (map read . words) nm
    (th,xs') = splitAt (n+m) xs
  show' r = case r of {Nothing -> "-1"; Just (t,h) -> show t ++ " " ++ show h} 

equal_total_scores :: [Int] -> [Int] -> Maybe (Int,Int)
equal_total_scores taro hanako = select (sort taro) (sort hanako)
 where
  diff = sum hanako - sum taro
  
  select [] _ = Nothing
  select _ [] = Nothing
  select (t:ts) (h:hs)
   | (h-t)*2 == diff = Just (t,h)
   | (h-t)*2 < diff = select (t:ts) hs
   | (h-t)*2 > diff = select ts (h:hs)