N=int(eval(input()))

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

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



diff=[[A[i]-B[i],i] for i in range(N)]

diff=sorted(diff,key=lambda x:x[0])



idx=-1

for i in range(N):

  while(diff[i][0]<0):

    if diff[idx][0]< 0:

      print("-1")

      exit(0)

    if abs(diff[i][0]) >= diff[idx][0]:

      diff[i][0]+=diff[idx][0]

      diff[idx][0]=0

      idx-=1

    else:

      diff[idx][0]+=diff[i][0]

      diff[i][0]=0

diff=sorted(diff,key=lambda x:x[1])

C=[B[i]+diff[i][0] for i in range(N)]

ans=0

for i in range(N):

  if A[i]!=C[i]:

    ans+=1

print(ans)

N = int(eval(input()))

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

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



diff = [A[i] - B[i] for i in range(N)]

if sum(diff) < 0:

    print((-1))

    exit(0)



minus = [diff[i] for i in range(N) if diff[i] < 0]

plus = [diff[i] for i in range(N) if diff[i] > 0]

plus.sort(reverse=True)

ans = len(minus)

minus_s = sum(minus)*(-1)

id = 0

while(minus_s > 0):

    minus_s -= plus[id]

    id += 1

print((ans+id))

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [[A[i] - B[i], i] for i in range(N)]
diff = sorted(diff, key=lambda x: x[0])
idx = -1
for i in range(N):
    while diff[i][0] < 0:
        if diff[idx][0] < 0:
            print("-1")
            exit(0)
        if abs(diff[i][0]) >= diff[idx][0]:
            diff[i][0] += diff[idx][0]
            diff[idx][0] = 0
            idx -= 1
        else:
            diff[idx][0] += diff[i][0]
            diff[i][0] = 0
diff = sorted(diff, key=lambda x: x[1])
C = [B[i] + diff[i][0] for i in range(N)]
ans = 0
for i in range(N):
    if A[i] != C[i]:
        ans += 1
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [A[i] - B[i] for i in range(N)]
if sum(diff) < 0:
    print((-1))
    exit(0)
minus = [diff[i] for i in range(N) if diff[i] < 0]
plus = [diff[i] for i in range(N) if diff[i] > 0]
plus.sort(reverse=True)
ans = len(minus)
minus_s = sum(minus) * (-1)
id = 0
while minus_s > 0:
    minus_s -= plus[id]
    id += 1
print((ans + id))

-diff = [[A[i] - B[i], i] for i in range(N)] -diff = sorted(diff, key=lambda x: x[0]) -idx = -1 -for i in range(N): -    while diff[i][0] < 0: -        if diff[idx][0] < 0: -            print("-1") -            exit(0) -        if abs(diff[i][0]) >= diff[idx][0]: -            diff[i][0] += diff[idx][0] -            diff[idx][0] = 0 -            idx -= 1 -        else: -            diff[idx][0] += diff[i][0] -            diff[i][0] = 0 -diff = sorted(diff, key=lambda x: x[1]) -C = [B[i] + diff[i][0] for i in range(N)] -ans = 0 -for i in range(N): -    if A[i] != C[i]: -        ans += 1 -print(ans) +diff = [A[i] - B[i] for i in range(N)] +if sum(diff) < 0: +    print((-1)) +    exit(0) +minus = [diff[i] for i in range(N) if diff[i] < 0] +plus = [diff[i] for i in range(N) if diff[i] > 0] +plus.sort(reverse=True) +ans = len(minus) +minus_s = sum(minus) * (-1) +id = 0 +while minus_s > 0: +    minus_s -= plus[id] +    id += 1 +print((ans + id))