loop do
  n, m = gets.split.map(&:to_i)
  break if n == 0 && m == 0
  taro_c = n.times.map{ gets.to_i }
  hana_c = m.times.map{ gets.to_i }
  dif = taro_c.reduce(:+) - hana_c.reduce(:+)
  ans = -1
  if dif.even?
    taro_c.uniq.each do |t|
      hana_c.uniq.each do |h|
        ans = [t, h] if (t - h) * 2 == dif && (ans == -1 || ans.reduce(:+) > t + h)
      end
    end
  end
  puts ans == -1 ? -1 : ans.join(' ')
end