#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<int(n); i++)
#define ALL(a) (a).begin(), (a).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll mod = 1e9 + 7;

long long gcd(ll x, ll y){
	if(x > y) swap(x, y);
	while(x != 0){ y %= x; swap(x, y); }
	return y;
}

ll mpow(ll x, ll r){
	if(r == 0) return 1;
	if(r % 2 == 1){ return x * mpow(x, r-1) % mod; }
	else{ ll aa = mpow(x, r/2); return aa*aa%mod; }
}

int main(){
	ll N, M; cin >> N >> M;
	ll A[M], s = 0;
	rep(i, M){ cin >> A[i]; s+=A[i]; }
	if(s <= N) cout << N - s << endl;
	else cout << -1 << endl;
	return 0;
}