#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define inf 1001001001001000
#define mod 1000000007
#define pi 3.1415926535
using namespace std;

int main(void){
    ll n,m;
    cin>>n>>m;
    vl a(m);
    rep(i,m) cin>>a[i];
    ll sum = 0;
    rep(i,m) sum+=a[i];
    if(sum>n) cout<<-1<<endl;
    else cout<<n-sum<<endl;
}
