def ascan; gets.split.map(&:to_i); end


while (n,m = ascan) != [0,0]
    xx = n.times.map{gets.to_i}
    yy = m.times.map{gets.to_i}
    
    ans = nil
    
    xsum = xx.reduce(:+)
    ysum = yy.reduce(:+)
    
    n.times do |i|
        m.times do |j|
            x = xx[i]
            y = yy[j]
            ans = [x,y]if xsum-2*x == ysum-2*y && (!ans || ans[0]+ans[1] > x+y)
        end
    end
    puts ans ? ans*" " : "-1"
end
