n, as, bs = ARGF.read.split("\n").map { |e| e.split }
xs = as.zip(bs).map { |e|
  a,b = e.map { |ee| ee.to_i }
  a - b
}.sort
ms = xs.select { |e|
  e < 0
}
ps = xs.select { |e|
  e > 0
}
if ms.length == 0
  puts 0
  exit
end

c = ms.length
val = 0
ms.each { |e|
  m = e.abs
  if val <= m
    loop {
      if ps.length == 0
        puts '-1'
        exit
      else
        val += ps.pop
        c += 1
        if val >= m
          val -= m
          break
        end
      end
    }
  else
    val -= m    
  end
}
puts c
