import numpy as np



def solve(A, B):

  diff = np.array(A) - np.array(B)

  shortage = list([d for d in diff if d < 0])

  remainder = sorted(list([d for d in diff if d > 0]), reverse=True)

  short_sum = sum(shortage)

  if short_sum == 0: return 0

  counter = 0

  for r in remainder:

    short_sum += r

    counter += 1

    if short_sum >= 0: return len(shortage) + counter

  return -1



N = int(eval(input()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))



print((solve(A, B)))
import operator



def solve(A, B):

  diff = list(map(operator.sub, A, B))

  shortage  = list([d for d in diff if d < 0])

  remainder = list([d for d in diff if d > 0])

  remainder.sort(reverse=True)

  short_sum = sum(shortage)

  if short_sum == 0: return 0

  counter = len(shortage)

  for r in remainder:

    short_sum += r

    counter += 1

    if short_sum >= 0: return counter

  return -1



N = int(eval(input()))

A = list(map(int, input().split()))

B = list(map(int, input().split()))



print((solve(A, B)))
import numpy as np


def solve(A, B):
    diff = np.array(A) - np.array(B)
    shortage = list([d for d in diff if d < 0])
    remainder = sorted(list([d for d in diff if d > 0]), reverse=True)
    short_sum = sum(shortage)
    if short_sum == 0:
        return 0
    counter = 0
    for r in remainder:
        short_sum += r
        counter += 1
        if short_sum >= 0:
            return len(shortage) + counter
    return -1


N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print((solve(A, B)))

import operator


def solve(A, B):
    diff = list(map(operator.sub, A, B))
    shortage = list([d for d in diff if d < 0])
    remainder = list([d for d in diff if d > 0])
    remainder.sort(reverse=True)
    short_sum = sum(shortage)
    if short_sum == 0:
        return 0
    counter = len(shortage)
    for r in remainder:
        short_sum += r
        counter += 1
        if short_sum >= 0:
            return counter
    return -1


N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print((solve(A, B)))

-import numpy as np +import operator -    diff = np.array(A) - np.array(B) +    diff = list(map(operator.sub, A, B)) -    remainder = sorted(list([d for d in diff if d > 0]), reverse=True) +    remainder = list([d for d in diff if d > 0]) +    remainder.sort(reverse=True) -    counter = 0 +    counter = len(shortage) -            return len(shortage) + counter +            return counter