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

f = []
p = []
n.times do |i|
  if a[i] < b[i]
    f << b[i] - a[i]
  elsif a[i] > b[i]
    p << a[i] - b[i]
  end
end

f.sort!
p.sort!

res = f.size
cnt = []
i = f.size - 1
j = p.size - 1
while i >= 0 && j >= 0
  cancel = [f[i], p[j]].min
  f[i] -= cancel
  p[j] -= cancel
  cnt << j
  if f[i] == 0
    i -= 1
  end
  if p[j] == 0
    j -= 1
  end
end

if i >= 0 && j < 0
  puts "-1"
elsif i < 0 && j == p.size - 1
  puts "0"
else
  res += cnt[0] - cnt[-1] + 1
  puts res
end
