#include <fstream>
#include <cstdio>

using namespace std;

int main()
{
	ifstream in("xpart.in");
	ofstream out("xpart.out");
	int n, m, x;
	long long p = 0, g = 0;
	in >> n >> m;
	for (int i = 0; i < n; i++) in >> x, p += x;
	for (int i = 0; i < m; i++) in >> x, g += x;
	out << max(-1LL,  p - g);
}