#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> // Common file
#include<ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)998244353
#define slld(x) scanf("%lld",&x)
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define ld long double
ll t = 1, tt;
inline ll add(ll x,ll y){x+=y;return x%hell;}
inline ll mult(ll x,ll y){x%=hell;y%=hell;return (x*y)%hell;}
inline ll powMod(ll base,ll expo){
	ll ans=1;
	expo%=(hell-1);
	while(expo){
		if(expo&1)ans=mult(ans,base);
		base=mult(base,base);
		expo>>=1;
	}
	return ans;
}
void solve(){
	ll n, m;
	cin>>n>>m;
	rep(i,0,m){
		ll x;
		cin>>x;
		n-=x;
	}
	if(n<0)cout<<"-1";
	else
		cout<<n;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	//cin>>t;
	tt=t;
    while(t--){
        solve();
        if(t!=0)cout<<"\n";
    }
    return 0;
}
