while true
  n,m = gets.split(" ").map{|str| str.to_i}
  break if n==0&&m==0

  taro = Array.new(n){gets.to_i}
  hanako = Array.new(m){gets.to_i}
  sumt = taro.inject(:+)
  sumh = hanako.inject(:+)

  #?????????????????????t,??±??????????????????h??¨????????? sumt-t+h = sumh+t-h??¨?????£????¬???????
  min = -1
  anst = 0
  ansh = 0
  for i in 0..n-1
    t = taro[i]
    for j in 0..m-1
      h = hanako[j]
      if sumt-sumh == 2*(t-h)
        if min==-1 || t+h <min
          min = t+h
          anst,ansh = t,h
        end
      end
    end
  end
  puts(min<0 ? -1 : "#{anst} #{ansh}") 
end