N = int(eval(input()))

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

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

if sum(B) > sum(A):

  print("-1")

  exit()

D = []

for i in range(N):

  D.append(A[i]-B[i])

D.sort()

#print(D)

num = 0

s = 0; t = -1

yoyu = 0

while D[s] < 0:

  if yoyu+D[s] <0:

    num += 1 #ここで一番余裕があるのを取り出す。

    yoyu += D[t]

    t -= 1

  num += 1 #ここで足りない分が足された試験

  yoyu += D[s]

  s += 1

print(num)  
N = int(eval(input()))

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

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



if sum(B)>sum(A):

  print((-1))

  exit()



amari = []

fusoku = []

for i in range(N):

  if A[i] < B[i]:

    fusoku.append(B[i]-A[i])

  elif A[i] > B[i]:

    amari.append(A[i]-B[i])

amari.sort(reverse=True)

ans = len(fusoku)

nokori = sum(fusoku)

now = 0

while nokori > 0:

  nokori -= amari[now]

  now += 1

  ans += 1

print(ans)

  



  





         
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(B) > sum(A):
    print("-1")
    exit()
D = []
for i in range(N):
    D.append(A[i] - B[i])
D.sort()
# print(D)
num = 0
s = 0
t = -1
yoyu = 0
while D[s] < 0:
    if yoyu + D[s] < 0:
        num += 1  # ここで一番余裕があるのを取り出す。
        yoyu += D[t]
        t -= 1
    num += 1  # ここで足りない分が足された試験
    yoyu += D[s]
    s += 1
print(num)

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if sum(B) > sum(A):
    print((-1))
    exit()
amari = []
fusoku = []
for i in range(N):
    if A[i] < B[i]:
        fusoku.append(B[i] - A[i])
    elif A[i] > B[i]:
        amari.append(A[i] - B[i])
amari.sort(reverse=True)
ans = len(fusoku)
nokori = sum(fusoku)
now = 0
while nokori > 0:
    nokori -= amari[now]
    now += 1
    ans += 1
print(ans)

-    print("-1") +    print((-1)) -D = [] +amari = [] +fusoku = [] -    D.append(A[i] - B[i]) -D.sort() -# print(D) -num = 0 -s = 0 -t = -1 -yoyu = 0 -while D[s] < 0: -    if yoyu + D[s] < 0: -        num += 1  # ここで一番余裕があるのを取り出す。 -        yoyu += D[t] -        t -= 1 -    num += 1  # ここで足りない分が足された試験 -    yoyu += D[s] -    s += 1 -print(num) +    if A[i] < B[i]: +        fusoku.append(B[i] - A[i]) +    elif A[i] > B[i]: +        amari.append(A[i] - B[i]) +amari.sort(reverse=True) +ans = len(fusoku) +nokori = sum(fusoku) +now = 0 +while nokori > 0: +    nokori -= amari[now] +    now += 1 +    ans += 1 +print(ans)