n = int(eval(input()))

As = [int(i) for i in input().split()]

Bs = [int(i) for i in input().split()]

ABs = sorted([a - b for a, b in zip(As, Bs)])

# print(As, Bs, ABs)

if sum(As) < sum(Bs):

    print((-1))

    exit()

if min(ABs) > 0:

    print((-1))

    exit()

mABs = [ab for ab in ABs if ab < 0]

msum, ans = sum(mABs), len(mABs)

# print(mABs, msum, ans)

now = -1

while msum < 0:

    msum += ABs[now]

    ans += 1

    now -= 1

print(ans)
n = int(eval(input()))

As = [int(i) for i in input().split()]

Bs = [int(i) for i in input().split()]

ABs = [a - b for a, b in zip(As, Bs)]

if sum(As) < sum(Bs) or min(ABs) > 0:

    print((-1))

    exit()

mABs = [ab for ab in ABs if ab < 0]

pABs = [ab for ab in ABs if ab > 0]

ans, t = len(mABs), sum(mABs)

for pab in sorted(pABs, reverse=True):

    if t >= 0:

        break

    ans += 1

    t += pab

print(ans)
n = int(eval(input()))
As = [int(i) for i in input().split()]
Bs = [int(i) for i in input().split()]
ABs = sorted([a - b for a, b in zip(As, Bs)])
# print(As, Bs, ABs)
if sum(As) < sum(Bs):
    print((-1))
    exit()
if min(ABs) > 0:
    print((-1))
    exit()
mABs = [ab for ab in ABs if ab < 0]
msum, ans = sum(mABs), len(mABs)
# print(mABs, msum, ans)
now = -1
while msum < 0:
    msum += ABs[now]
    ans += 1
    now -= 1
print(ans)

n = int(eval(input()))
As = [int(i) for i in input().split()]
Bs = [int(i) for i in input().split()]
ABs = [a - b for a, b in zip(As, Bs)]
if sum(As) < sum(Bs) or min(ABs) > 0:
    print((-1))
    exit()
mABs = [ab for ab in ABs if ab < 0]
pABs = [ab for ab in ABs if ab > 0]
ans, t = len(mABs), sum(mABs)
for pab in sorted(pABs, reverse=True):
    if t >= 0:
        break
    ans += 1
    t += pab
print(ans)

-ABs = sorted([a - b for a, b in zip(As, Bs)]) -# print(As, Bs, ABs) -if sum(As) < sum(Bs): -    print((-1)) -    exit() -if min(ABs) > 0: +ABs = [a - b for a, b in zip(As, Bs)] +if sum(As) < sum(Bs) or min(ABs) > 0: -msum, ans = sum(mABs), len(mABs) -# print(mABs, msum, ans) -now = -1 -while msum < 0: -    msum += ABs[now] +pABs = [ab for ab in ABs if ab > 0] +ans, t = len(mABs), sum(mABs) +for pab in sorted(pABs, reverse=True): +    if t >= 0: +        break -    now -= 1 +    t += pab