#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main()
{
	int n, m;
	cin >> n >> m;
	int c = 0;
	for (int i = 0; i < m; i++) {
		int a;
		cin >> a;
		c += a;
	}
	cout << ((n - c < 0) ? -1 : n - c) << endl;
	return 0;
}