answers = []

def get_answer(taro, hanako, answers)
  taro
  hanako
  temp_ans = []
  taro_sum = 0
  hanako_sum = 0
  taro.each do |t|
    taro_sum += t
  end
  hanako.each do |h|
    hanako_sum += h
  end
  taro.each do |t|
    hanako.each do |h|
      if (taro_sum - t + h) == (hanako_sum + t -h)
        temp_ans << [t, h, t+h]
        return answers << "#{t} #{h}"
      end
    end
  end
  return answers << (-1) if temp_ans.length == 0
  mini_num = 300
  temp_ans.each_with_index do |a, i|
    if mini_num < a[2]
      mini_num = a[2]
      mini_index = i
    end
  end
  return answers << "#{temp_ans[mini_index][0]} #{temp_ans[mini_index][1]}"

end


while true
  array = gets.chomp.split(" ").map(&:to_i)
  n = array[0].to_i
  m = array[1].to_i
  break if n == 0 && m == 0
  taro =[]
  hanako = []
  n.times do
    taro << gets.to_i
  end
  m.times do
    hanako << gets.to_i
  end
  answers = get_answer(taro, hanako, answers)
end

answers.each do |ans|
  puts ans
end