n = int(eval(input()))

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

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



if sum(a) < sum(b): print((-1))

else:

    cnt = 0

    Abs = []

    s = 0

    for i in range(n):

        if a[i] < b[i]: 

            cnt += 1

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

        elif a[i] > b[i]:

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

    Abs.sort(reverse=True)

    s2 = 0

    i = 0

    while s2 < s:

        s2 += Abs[i]

        i += 1

    print((i+cnt))
from collections import deque

n = int(eval(input()))

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

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

# Aの総和 = Cの総和

p = []

cnt_p = 0

cnt_m = 0

x = 0

for a,b in zip(A,B):

    if a > b:

        cnt_p += 1

        p.append(a-b)

    elif a < b:

        cnt_m += 1

        x += b-a



if cnt_m==0:

    print((0))

    exit()



p = deque(sorted(p)[::-1])

while p and x > 0:

    P = p.popleft()

    if P <= x: x -= P

    else: x = 0

if x == 0:

    print((cnt_m+cnt_p-len(p)))

else:

    print((-1))
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < sum(b):
    print((-1))
else:
    cnt = 0
    Abs = []
    s = 0
    for i in range(n):
        if a[i] < b[i]:
            cnt += 1
            s += b[i] - a[i]
        elif a[i] > b[i]:
            Abs.append(a[i] - b[i])
    Abs.sort(reverse=True)
    s2 = 0
    i = 0
    while s2 < s:
        s2 += Abs[i]
        i += 1
    print((i + cnt))

from collections import deque

n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# Aの総和 = Cの総和
p = []
cnt_p = 0
cnt_m = 0
x = 0
for a, b in zip(A, B):
    if a > b:
        cnt_p += 1
        p.append(a - b)
    elif a < b:
        cnt_m += 1
        x += b - a
if cnt_m == 0:
    print((0))
    exit()
p = deque(sorted(p)[::-1])
while p and x > 0:
    P = p.popleft()
    if P <= x:
        x -= P
    else:
        x = 0
if x == 0:
    print((cnt_m + cnt_p - len(p)))
else:
    print((-1))

+from collections import deque + -a = list(map(int, input().split())) -b = list(map(int, input().split())) -if sum(a) < sum(b): +A = list(map(int, input().split())) +B = list(map(int, input().split())) +# Aの総和 = Cの総和 +p = [] +cnt_p = 0 +cnt_m = 0 +x = 0 +for a, b in zip(A, B): +    if a > b: +        cnt_p += 1 +        p.append(a - b) +    elif a < b: +        cnt_m += 1 +        x += b - a +if cnt_m == 0: +    print((0)) +    exit() +p = deque(sorted(p)[::-1]) +while p and x > 0: +    P = p.popleft() +    if P <= x: +        x -= P +    else: +        x = 0 +if x == 0: +    print((cnt_m + cnt_p - len(p))) +else: -else: -    cnt = 0 -    Abs = [] -    s = 0 -    for i in range(n): -        if a[i] < b[i]: -            cnt += 1 -            s += b[i] - a[i] -        elif a[i] > b[i]: -            Abs.append(a[i] - b[i]) -    Abs.sort(reverse=True) -    s2 = 0 -    i = 0 -    while s2 < s: -        s2 += Abs[i] -        i += 1 -    print((i + cnt))