n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
a_m = a.clone

diff = a.map.with_index{|x,i| x - b[i]}

n.times do |i|
  if diff[i] < 0
    if diff.max > 0
      a[diff.index(diff.max)] += diff[i]
      a[i] -= diff[i]
    else
      puts "-1"
      exit
    end
  end
  diff = a.map.with_index{|x,i| x - b[i]}
end

count = 0
a_m.each_with_index do |x,i|
  count += 1 if x != a[i]
end

puts count