N = int(eval(input()))

A = [int(_) for _ in input().split()]

B = [int(_) for _ in input().split()]



M = []

P = []



for i in range(N):

    tmp = A[i] - B[i]

    if tmp < 0:

        M.append(tmp)

    else:

        P.append(tmp)



ms = sum(M)

if ms == 0:

    print((0))

    exit(0)



P.sort(reverse=True)



count = 0

for pi in P:

    count += 1

    ms += pi

    if ms >= 0:

        break

else:

    print((-1))

    exit(0)



print((count + len(M)))
from itertools import accumulate



N = int(eval(input()))

A = [int(i) for i in input().split()]

B = [int(i) for i in input().split()]



D = [ai - bi for ai, bi in zip(A, B)]

M = [di for di in D if di < 0]

P = [di for di in D if di > 0]



sum_m = sum(M)

if sum_m == 0:

    print((0))

    exit()



P = accumulate(sorted(P, reverse=True))

for i, pi in enumerate(P):

    if pi + sum_m >= 0:

        print((len(M) + i + 1))

        exit()

print((-1))

N = int(eval(input()))
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
M = []
P = []
for i in range(N):
    tmp = A[i] - B[i]
    if tmp < 0:
        M.append(tmp)
    else:
        P.append(tmp)
ms = sum(M)
if ms == 0:
    print((0))
    exit(0)
P.sort(reverse=True)
count = 0
for pi in P:
    count += 1
    ms += pi
    if ms >= 0:
        break
else:
    print((-1))
    exit(0)
print((count + len(M)))

from itertools import accumulate

N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
D = [ai - bi for ai, bi in zip(A, B)]
M = [di for di in D if di < 0]
P = [di for di in D if di > 0]
sum_m = sum(M)
if sum_m == 0:
    print((0))
    exit()
P = accumulate(sorted(P, reverse=True))
for i, pi in enumerate(P):
    if pi + sum_m >= 0:
        print((len(M) + i + 1))
        exit()
print((-1))

+from itertools import accumulate + -A = [int(_) for _ in input().split()] -B = [int(_) for _ in input().split()] -M = [] -P = [] -for i in range(N): -    tmp = A[i] - B[i] -    if tmp < 0: -        M.append(tmp) -    else: -        P.append(tmp) -ms = sum(M) -if ms == 0: +A = [int(i) for i in input().split()] +B = [int(i) for i in input().split()] +D = [ai - bi for ai, bi in zip(A, B)] +M = [di for di in D if di < 0] +P = [di for di in D if di > 0] +sum_m = sum(M) +if sum_m == 0: -    exit(0) -P.sort(reverse=True) -count = 0 -for pi in P: -    count += 1 -    ms += pi -    if ms >= 0: -        break -else: -    print((-1)) -    exit(0) -print((count + len(M))) +    exit() +P = accumulate(sorted(P, reverse=True)) +for i, pi in enumerate(P): +    if pi + sum_m >= 0: +        print((len(M) + i + 1)) +        exit() +print((-1))