object Main {
  import java.util.Scanner

  def readStrings(n: Int)(implicit sc: Scanner): Array[String] = Array.fill(n) { sc.next() }
  def readInts(n: Int)(implicit sc: Scanner): Array[Int] = Array.fill(n) { sc.nextInt() }
  def readLongs(n: Int)(implicit sc: Scanner): Array[Long] = Array.fill(n) { sc.nextLong() }
  def readLineStrings(implicit sc: Scanner): Array[String] = sc.nextLine().split(' ')
  def readLineInts(implicit sc: Scanner): Array[Int] = readLineStrings.map(_.toInt)
  def readLineLongs(implicit sc: Scanner): Array[Long] = readLineStrings.map(_.toLong)

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(implicit sc: Scanner): Unit = {
    val N = readLineLongs(sc)(0)
    val A = readLineLongs
    val B = readLineLongs
    val AmB = A.zip(B).map { case (a, b) => a - b }
    if (AmB.sum < 0) return print(-1)

    val (negatives, positives) = AmB.partition(_ < 0)
    val negSorted = negatives.sorted(implicitly[Ordering[Long]].reverse)
    val posSorted = positives.filter(_ > 0).sorted

    def posUseNumber: Int = {
      var negIndex = 0
      var posMinUnaltered = 0

      while (negIndex < negSorted.length) {
        val a = negSorted(negIndex)

        def search: Option[Int] = {
          for {i <- posSorted.indices} if (posSorted(i) > a) return Some(i)
          None
        }
        search match {
          case Some(index) => {
            posSorted(index) -= a
            negSorted(negIndex) = 0

            negIndex += 1
            posMinUnaltered = Math.max(posMinUnaltered, index + 1)
          }
          case None => {
            var negToFill = negSorted.sum * (-1)
            val (usedPos, unusedPos) = posSorted.splitAt(posMinUnaltered)
            negToFill -= usedPos.sum
            val additionalUse = unusedPos.scan(0L)(_ + _).takeWhile(_ < negToFill).length
            return posMinUnaltered + additionalUse
          }
        }
      }
      posMinUnaltered
    }
    println(negSorted.length + posUseNumber)
  }
}
