#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef int i;
typedef string s;
typedef double d;

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define tt int t; cin>>t; while(t--)
#define lo(i, a, b) for(int i=a; i<b; i++)
#define rlo(i, a) for(int i=a; i>0; i--)
#define be(a) a.begin(),a.end()
#define sz(x) x.size()
#define nl cout<<"\n";
#define sp cout<<" ";

#define op() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

int main()
{
    op();
    i n,m,a,sum=0;
    cin>>n>>m;
    while(m--)
    {
       cin>>a;
       sum+=a;
    }
    if(n>=sum)
        cout<<n-sum;
    else
        cout<<-1;
    nl;
    return 0;
}

