import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.datetime;
import std.numeric;
import std.math;
import std.string;

string my_readln() { return chomp(readln()); }

void main()
{
	//auto tokens = split(my_readln());
	auto N = my_readln().to!ulong();
	ulong[] A, B;
	long[] C;
	foreach (token; split(my_readln()))
	{
		A ~= token.to!ulong;
	}
	foreach (i, token; split(my_readln()))
	{
		B ~= token.to!ulong;
		C ~= A[i] - B[$-1];
	}
	auto index = new ulong[C.length];
	makeIndex(C, index);

	long ans;
	long want;
	foreach (i, ci; index)
	{
		if (C[ci] >= 0)
		{
			ans = i;
			break;
		}
		want -= C[ci];
	}
	foreach_reverse (i, ci; index)
	{
		if (want <= 0)
		{
			ans += index.length - i - 1;
			break;
		}
		if (C[ci] <= 0)
		{
			ans = -1;
			break;
		}
		want -= C[ci];
	}

	writeln(ans);
	stdout.flush();
}