#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    int m,a,sum=0,p;
    cin>>n>>m;
    for(int i=0; i<m; i++){
        cin>>a;
        sum+=a;
    }
    p=n-sum;
    if(n>p)
        cout<<p<<endl;
    else if(n==p)
        cout<<0<<endl;
    else
        cout<<-1<<endl;
    return 0;
}
