N = int(eval(input()))



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

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

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

ans = 0

if sum(A) < sum(B) :

    ans = -1

else :

    debt = []

    deposit = []

    for i in range(N) :

        if L[i] < 0 :

            debt.append(-L[i])

        elif L[i] > 0 :

            deposit.append(L[i])

        

    debt = sorted(debt)

    deposit = sorted(deposit,reverse=True)

    

    debt_duplicated = debt.copy()

    deposit_duplicated = deposit.copy()

    

    deposit_trash = []

    

    #print(debt)

    #print(deposit)

    

    for i in range(len(debt)) :

        

        while True :

            if debt[i] == 0 :

                break

            else :

                if debt[i] <= deposit[0] :

                    deposit[0] -= debt[i]

                    debt[i] = 0

                else :

                    debt[i] -= deposit[0]

                    deposit[0] = 0

                    deposit_trash.append(deposit.pop(0))

        

            

        

#        for j in range(len(deposit)) :

#            if debt[i] <= deposit[j] :

#                deposit[j] -= debt[i]

#                debt[i] = 0

#                break

#            else :

#                debt[i] -= deposit[j]

#                deposit[j] = 0

    deposit = deposit_trash + deposit

    for i in range(len(debt)) :

        if debt[i] != debt_duplicated[i] :

            ans += 1

    for i in range(len(deposit)) :

        if deposit[i] != deposit_duplicated[i] :

            ans += 1



print(ans)

#print(debt)

#print(deposit)



N = int(eval(input()))

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

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



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

ans = 0



if sum(A) < sum(B) :

    ans = -1

else :

    debt = []

    deposit = []

    

    for i in range(N) :

        if L[i] < 0 :

            debt.append(-L[i])

        elif L[i] > 0 :

            deposit.append(L[i])

    

    deposit = sorted(deposit,reverse=True)

    debt_sum = sum(debt)

    

    ans += len(debt)

    

    while debt_sum > 0 :

        if debt_sum <= deposit[0] :

            deposit[0] = 0

            debt_sum = 0

        else :

            debt_sum -= deposit.pop(0)

        ans += 1

        

print(ans)

#print(debt)

#print(deposit)



N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B):
    ans = -1
else:
    debt = []
    deposit = []
    for i in range(N):
        if L[i] < 0:
            debt.append(-L[i])
        elif L[i] > 0:
            deposit.append(L[i])
    debt = sorted(debt)
    deposit = sorted(deposit, reverse=True)
    debt_duplicated = debt.copy()
    deposit_duplicated = deposit.copy()
    deposit_trash = []
    # print(debt)
    # print(deposit)
    for i in range(len(debt)):
        while True:
            if debt[i] == 0:
                break
            else:
                if debt[i] <= deposit[0]:
                    deposit[0] -= debt[i]
                    debt[i] = 0
                else:
                    debt[i] -= deposit[0]
                    deposit[0] = 0
                    deposit_trash.append(deposit.pop(0))
    #        for j in range(len(deposit)) :
    #            if debt[i] <= deposit[j] :
    #                deposit[j] -= debt[i]
    #                debt[i] = 0
    #                break
    #            else :
    #                debt[i] -= deposit[j]
    #                deposit[j] = 0
    deposit = deposit_trash + deposit
    for i in range(len(debt)):
        if debt[i] != debt_duplicated[i]:
            ans += 1
    for i in range(len(deposit)):
        if deposit[i] != deposit_duplicated[i]:
            ans += 1
print(ans)
# print(debt)
# print(deposit)

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B):
    ans = -1
else:
    debt = []
    deposit = []
    for i in range(N):
        if L[i] < 0:
            debt.append(-L[i])
        elif L[i] > 0:
            deposit.append(L[i])
    deposit = sorted(deposit, reverse=True)
    debt_sum = sum(debt)
    ans += len(debt)
    while debt_sum > 0:
        if debt_sum <= deposit[0]:
            deposit[0] = 0
            debt_sum = 0
        else:
            debt_sum -= deposit.pop(0)
        ans += 1
print(ans)
# print(debt)
# print(deposit)

-    debt = sorted(debt) -    debt_duplicated = debt.copy() -    deposit_duplicated = deposit.copy() -    deposit_trash = [] -    # print(debt) -    # print(deposit) -    for i in range(len(debt)): -        while True: -            if debt[i] == 0: -                break -            else: -                if debt[i] <= deposit[0]: -                    deposit[0] -= debt[i] -                    debt[i] = 0 -                else: -                    debt[i] -= deposit[0] -                    deposit[0] = 0 -                    deposit_trash.append(deposit.pop(0)) -    #        for j in range(len(deposit)) : -    #            if debt[i] <= deposit[j] : -    #                deposit[j] -= debt[i] -    #                debt[i] = 0 -    #                break -    #            else : -    #                debt[i] -= deposit[j] -    #                deposit[j] = 0 -    deposit = deposit_trash + deposit -    for i in range(len(debt)): -        if debt[i] != debt_duplicated[i]: -            ans += 1 -    for i in range(len(deposit)): -        if deposit[i] != deposit_duplicated[i]: -            ans += 1 +    debt_sum = sum(debt) +    ans += len(debt) +    while debt_sum > 0: +        if debt_sum <= deposit[0]: +            deposit[0] = 0 +            debt_sum = 0 +        else: +            debt_sum -= deposit.pop(0) +        ans += 1