#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main() {

	ios::sync_with_stdio(false);
	cin.tie(0);
	
	ll n, m;
	cin >> n >> m;
	vector<int> a(m);
	int sum = 0;
	
	for(int i = 0; i < m; ++i) {
		cin >> a[i];
		sum += a[i];
	}
	
	if(sum > n) cout << -1 << "\n";
	else cout << n - sum << "\n";
	
	return 0;
}
