n,m = gets.split.map(&:to_i)
while n != 0 && m != 0
	sn = []
	sm = []

	sum_sn = 0
	sum_sm = 0
	n.times do  
		i = gets.to_i
		sn.push(i)
		sum_sn += i
	end
	m.times do 
		i = gets.to_i
		sm.push(i)
		sum_sm += i
	end
	sn = sn.sort
	sm = sm.sort

	if sum_sn > sum_sm
		diff = sum_sn - sum_sm
	else
		diff = sum_sm - sum_sn
	end

	a = 0
	b = 0
	sn = sn.reverse
	sm = sm.reverse
	sn.each do |sn_tmp|
		sm.each do |sm_tmp|
			if sn_tmp > sm_tmp && sn_tmp - sm_tmp == diff / 2
				a = sn_tmp
				b = sm_tmp
			elsif sn_tmp < sm_tmp && sm_tmp - sn_tmp == diff / 2
				a = sn_tmp
				b = sm_tmp
			elsif  diff == 0 && sn_tmp == sm_tmp
				a = sn_tmp
				b = sm_tmp
			end
		end
	end
	if a == 0 && b == 0
		puts "-1"
	elsif
	print(a," ",b)
	puts
	end
	n,m = gets.split.map(&:to_i)
	p a
end