loop do
  n, m = gets.chomp.split.map &:to_i
  break if n == 0 && m == 0

  t = (0...n).inject(Array.new){|s| s << gets.to_i}
  h = (0...m).inject(Array.new){|s| s << gets.to_i}
  tm = t.inject(0){|sum, i| sum += i}
  hm = h.inject(0){|sum, i| sum += i}
  target = ( tm > hm ? tm : hm ) - ( tm - hm ).abs / 2

  result = nil
  catch :fin do
    t.each do |ti|
      h.each do |hi|
        if ( tm - ti + hi == target && hm - hi + ti == target )
          result = [ti, hi]
          throw :fin
        end
      end
    end
  end

  puts result.nil? ? -1 : "#{result[0]} #{result[1]}"
end