def sum(a)
    s = 0
    a.each do |v|
        s += v
    end
    return s
end

def copy(a)
    b = []
    a.each do |v|
        b.push(v)
    end
    return b
end

input_data = gets.chomp.split(" ")
taro = input_data[0].to_i
hanako = input_data[1].to_i

while taro != 0 do 
    taroNumberArr = []
    taro.times do |i|
        taroNumber = gets.chomp.to_i
        taroNumberArr.push(taroNumber)
    end
    taroNumberArr.sort!
    
    hanakoNumberArr = []
    hanako.times do |j|
        hanakoNumber = gets.chomp.to_i
        hanakoNumberArr.push(hanakoNumber)
    end
    hanakoNumberArr.sort!
    
    endFlug = false
    taro.times do |i|
        hanako.times do |j|
            tc = copy(taroNumberArr)
            hc = copy(hanakoNumberArr)
            #要素のスワップをする。
            tem = tc[i]
            tc[i] = hc[j]
            hc[j] = tem
            if(sum(tc) == sum(hc))
                puts taroNumberArr[i].to_s + ' '+ hanakoNumberArr[j].to_s
                endFlug = true
                break
            end
        end
        break if endFlug
    end
    
    puts -1 unless endFlug
    input_data = gets.chomp.split(" ")
    taro = input_data[0].to_i
    hanako = input_data[1].to_i
end
