from bisect import bisect_right

n = int(eval(input()))

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

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

if sum(a) == sum(b):

    print(n)

mp = 0

ans = 0

l = []

for i in range(n):

    if a[i] < b[i]:

        mp -= b[i] - a[i]

    elif a[i] >= b[i]:

        mp += a[i] - b[i]

        l.append(a[i] - b[i])

l.sort()

if mp < 0:

    print((-1))

else:

    for i in range(len(l) - 1):

        l[i + 1] += l[i]

    print((n - bisect_right(l, mp)))
n=int(eval(input()))

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

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

if sum(a)<sum(b):

  print((-1))

  exit(0)

t=sum(a)-sum(b)

l=[]

for i in range(n):

  if a[i] >= b[i]:

    l.append(a[i]-b[i])

l.sort()

ans=0

for x in l:

  t-=x

  if t<0:

    break

  ans+=1

print((n-ans))
from bisect import bisect_right

n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) == sum(b):
    print(n)
mp = 0
ans = 0
l = []
for i in range(n):
    if a[i] < b[i]:
        mp -= b[i] - a[i]
    elif a[i] >= b[i]:
        mp += a[i] - b[i]
        l.append(a[i] - b[i])
l.sort()
if mp < 0:
    print((-1))
else:
    for i in range(len(l) - 1):
        l[i + 1] += l[i]
    print((n - bisect_right(l, mp)))

n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
    print((-1))
    exit(0)
t = sum(a) - sum(b)
l = []
for i in range(n):
    if a[i] >= b[i]:
        l.append(a[i] - b[i])
l.sort()
ans = 0
for x in l:
    t -= x
    if t < 0:
        break
    ans += 1
print((n - ans))

-from bisect import bisect_right - -if sum(a) == sum(b): -    print(n) -mp = 0 -ans = 0 +if sum(a) < sum(b): +    print((-1)) +    exit(0) +t = sum(a) - sum(b) -    if a[i] < b[i]: -        mp -= b[i] - a[i] -    elif a[i] >= b[i]: -        mp += a[i] - b[i] +    if a[i] >= b[i]: -if mp < 0: -    print((-1)) -else: -    for i in range(len(l) - 1): -        l[i + 1] += l[i] -    print((n - bisect_right(l, mp))) +ans = 0 +for x in l: +    t -= x +    if t < 0: +        break +    ans += 1 +print((n - ans))