loop {
	n, m = gets.split.map &:to_i
	break if n == 0
	a = (1..n).map { gets.to_i }
	b = (1..m).map { gets.to_i }
	a_sum = a.inject(:+)
	b_sum = b.inject(:+)
	ok = false
	a.product(b).each{|x, y|
		if a_sum - x + y == b_sum - y + x
			puts "#{x} #{y}"
			ok = true
			break
		end
	}
	puts -1 unless ok
}