### main

loop do
  n, m = gets.split.map(&:to_i)
  break if (n | m) == 0

  sts = n.times.map{gets.to_i}.sort
  shs = m.times.map{gets.to_i}.sort

  tsum = sts.inject(:+)
  hsum = shs.inject(:+)

  dsum = hsum - tsum
  if (dsum & 1) != 0
    puts -1
    next
  end

  sd = dsum / 2

  exc = nil

  for st in sts
    sh = st + sd
    if shs.index(sh)
      exc = [st, sh]
      break
    end
  end

  puts exc.nil? ? -1 : exc.join(' ')
end