#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 100005
int a[N],b[N],n,ans;
priority_queue<int>q;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)scanf("%d",&b[i]);
	for(int i=1;i<=n;i++)if(a[i]>b[i])q.push(a[i]-b[i]);
	for(int i=1,now=0;i<=n;i++)
	{
		if(a[i]<b[i])
		{
			ans++;
			while(now<b[i]-a[i])
			{
				if(q.empty())return puts("-1"),0;
				a[i]+=now,now=q.top();q.pop();ans++;
			}
			now-=b[i]-a[i];
		}
	}
	printf("%d\n",ans);
}