#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n,m;
 cin>>n>>m;
 vector<ll> a(m);
 for(ll i=0;i<m;i++)cin>>a[i];
 ll sum = 0;
 for(auto i:a)sum+=i;
 
 if(n-sum >= 0 )cout<<n-sum<<endl;
 else cout<<-1<<endl;   
 return 0;
}
