/*  TAHMID RAHMAN
    DAMIAN FOREVER
     MATH LOVER
    NEVER GIVE UP
*/
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define pb push_back
#define fi first
#define se second
#define in insert
#define mp make_pair
#define gcd(a,b) __gcd(a,b);
int main()
{
    fastio;
    ll n,m,i,s=0;
    cin>>n>>m;
    vector<ll>v(m);
    for(i=0;i<m;i++)
    {
        cin>>v[i];
    }
    for(i=0;i<m;i++)
    {
        s=s+v[i];
    }
    if(s>n)
        cout<<"-1"<<endl;
    else
    {
        cout<<n-s<<endl;
    }
}
