loop do
    n, m = gets.split.map(&:to_i)
    break if n == 0 && m == 0
    t = n.times.map{gets.to_i}
    h = m.times.map{gets.to_i}
    tsum = t.inject(:+)
    hsum = h.inject(:+)
    min = tsum + hsum + 1
    t1 = h1 = 0
    t.each do |tt|
        h.each do |hh|
            hc = hsum - hh + tt
            tc = tsum - tt + hh
            if tc == hc
                if tt + hh < min
                    min = [tt + hh, min].min
                    t1 = tt
                    h1 = hh
                end
            end
        end
    end
    if min == tsum + hsum + 1
        puts "-1"
    else
        puts "#{t1} #{h1}"
    end
end