#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	int sum = 0;
	vec c(b);
	for (int i = 0; i < b; i++) {
		cin >> c[i];
		sum += c[i];
	}
	if (sum > a) cout << "-1" << endl;
	else cout << a - sum << endl;
}
