#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define sf scanf
#define pf printf 
#define nl printf("\n")
#define pi acos(-1)

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    #endif

    ll n,m,x,sum=0;
    sf("%lld %lld",&n,&m);
    for(int i=0; i<m; i++){
        sf("%lld",&x);
        sum += x;
    }
    if(sum>n) pf("-1\n");
    else  pf("%lld\n",n-sum);
    return 0;
}