#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n, m;
	cin >> n >> m;
	ll sum = 0;
	rep(i, m) {
		ll a;
		cin >> a;
		sum += a;
	}
	if (sum > n) {
		cout << -1 << endl;
	} else {
		cout << n - sum << endl;
	}
	return 0;
}

