#20131107

while true
	n,m = gets.split(" ").map{|e|e.to_i}
	break if n==0 && m==0
	t,h = [],[]
	n.times{t.push gets.to_i}
	m.times{h.push gets.to_i}

	diff = t.inject(:+) - h.inject(:+)
	flag = false
	t.each{|e1|
		h.each{|e2|
			if (e2-e1)*2 == diff.abs 
				puts "#{e1} #{e2}"
				flag = true
			end
			break if flag
		}
		break if flag
	}

	puts -1 if !flag
end