#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	int n, m, a, sum = 0;
	cin >> n  >> m;
	for (int i = 0; i < m; i++) {
		cin >> a;
		sum += a;
	}
	if (sum > n) {
		cout << -1 ;
	}
	else {
		cout << (n - sum);
	}
}