while true
    n, m = gets.chomp.split.map(&:to_i)
    break if [n, m] == [0, 0]
    arr1 = []
    arr2 = []
    n.times{arr1 << gets.to_i}
    m.times{arr2 << gets.to_i}
    sum1 = arr1.sort!.inject(:+)
    sum2 = arr2.sort!.inject(:+)
    diff = sum1 - sum2
    min, card = nil, []
    if diff.even?
        arr1.each{|card1|
            arr2.each{|card2|
                if (card1 == card2 + diff/2.0) && (min.nil? || min > card1 + card2)
                    min = card1 + card2
                    card = [card1, card2]
                    break
                end
            }
        }
    end
    puts min.nil? ? -1 : card.join(" ")
end
