#include <bits/stdc++.h>

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const unsigned int mod = 1e9 + 7;

using namespace std;

int32_t main() {
	fastio;

	int n, m;
	cin >> n >> m;
	int tot = 0;
	while(m--) {
		int x;
		cin >> x;
		tot += x;
	}
	if(tot <= n)
		cout << n - tot;
	else
		cout << -1;

	return 0;
}
