#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back

#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const double pi=acos(-1);
const int N=1e4+10;
int a[N],n,m;
void solve()
{
    cin>>m>>n;
    int sum=0;
    rep(i,1,n)
    {
        cin>>a[i];
        sum+=a[i];
    }
    int ans=m-sum;
    ans=max(-1,ans);
    cout<<ans<<endl;
}
int main()
{
	//int _;cin>>_;while(_--)
	solve();
}
