#include <iostream>

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	int a;
	int sum = 0;
	for (int i = 0; i < m; i++) {
		cin >> a;
		sum += a;
	}

	cout << (sum > n ? -1 : n - sum) << endl;

	return 0;
}