from itertools import accumulate



n=int(eval(input()))

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

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



if sum(a)<sum(b):

 print((-1))

 exit()



c=[]

lack=0

cnt=0

for i,j in zip(a,b):

  t=i-j

  if i-j>=0:

    c.append(t)

  else:

    lack+=abs(t)

    cnt+=1



if cnt==0:

  print((0))

  exit()



c=sorted(c,reverse=True)

ru=list(accumulate(c))

for i in range(len(ru)):

  if ru[i]>=lack:

    cnt+=i+1

    break



print(cnt)
from sys import stdin

nii=lambda:list(map(int,stdin.readline().split()))

lnii=lambda:list(map(int,stdin.readline().split()))



n=int(eval(input()))

a=lnii()

b=lnii()



plus=[]

minus=0

ans=0

for i in range(n):

  if a[i]<b[i]:

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

    ans+=1

  else:

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



if minus==0:

  print((0))

  exit()



plus.sort(reverse=True)

for i in range(len(plus)):

  minus-=plus[i]

  ans+=1

  if minus<=0:

    print(ans)

    exit()



print((-1))
from itertools import accumulate

n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
    print((-1))
    exit()
c = []
lack = 0
cnt = 0
for i, j in zip(a, b):
    t = i - j
    if i - j >= 0:
        c.append(t)
    else:
        lack += abs(t)
        cnt += 1
if cnt == 0:
    print((0))
    exit()
c = sorted(c, reverse=True)
ru = list(accumulate(c))
for i in range(len(ru)):
    if ru[i] >= lack:
        cnt += i + 1
        break
print(cnt)

from sys import stdin

nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n = int(eval(input()))
a = lnii()
b = lnii()
plus = []
minus = 0
ans = 0
for i in range(n):
    if a[i] < b[i]:
        minus += b[i] - a[i]
        ans += 1
    else:
        plus.append(a[i] - b[i])
if minus == 0:
    print((0))
    exit()
plus.sort(reverse=True)
for i in range(len(plus)):
    minus -= plus[i]
    ans += 1
    if minus <= 0:
        print(ans)
        exit()
print((-1))

-from itertools import accumulate +from sys import stdin +nii = lambda: list(map(int, stdin.readline().split())) +lnii = lambda: list(map(int, stdin.readline().split())) -a = list(map(int, input().split())) -b = list(map(int, input().split())) -if sum(a) < sum(b): -    print((-1)) -    exit() -c = [] -lack = 0 -cnt = 0 -for i, j in zip(a, b): -    t = i - j -    if i - j >= 0: -        c.append(t) +a = lnii() +b = lnii() +plus = [] +minus = 0 +ans = 0 +for i in range(n): +    if a[i] < b[i]: +        minus += b[i] - a[i] +        ans += 1 -        lack += abs(t) -        cnt += 1 -if cnt == 0: +        plus.append(a[i] - b[i]) +if minus == 0: -c = sorted(c, reverse=True) -ru = list(accumulate(c)) -for i in range(len(ru)): -    if ru[i] >= lack: -        cnt += i + 1 -        break -print(cnt) +plus.sort(reverse=True) +for i in range(len(plus)): +    minus -= plus[i] +    ans += 1 +    if minus <= 0: +        print(ans) +        exit() +print((-1))