#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,M;
	cin >> N >> M;

	vector<int>A(M);
	int sum = 0;
	rep(i, M) {
		cin >> A[i];
		sum += A[i];
	}

	if (sum > N) {
		cout << -1 << endl;
		return 0;
	}
	else {
		ans = N - sum;
	}


	cout << ans << endl;

	return 0;
}