while true
  n, m = gets.chomp.split(" ").map(&:to_i)
  break if n == 0 && m == 0
  asum = 0
  a = []
  n.times do
    x = gets.chomp.to_i
    asum += x
    a << x
  end
  bsum = 0
  b = []
  m.times do
    x = gets.chomp.to_i
    bsum += x
    b << x
  end
  flag = false
  cursum = 500
  retx = 0
  rety = 0
  a.each do |x|
    y = 2 * x - (asum - bsum)
    if !(b.find{|i| 2 * i == y}.nil?) then
    flag = true
    if (2 * x + y) < cursum then
      cursum = 2 * x + y
      retx = x
      rety = y / 2
    end
    end
  end
  if flag then
    puts "#{retx} #{rety}"
  else
    puts -1
  end
end