#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
long long date,n,tmp,sum=0;
void solve(){
    if(date>=sum) {
        cout<<date-sum<<endl;
    }else{
        cout<<"-1"<<endl;
    }
}

int main(){
    cin>>date>>n;
    rep(i,n){
        cin>>tmp;
        sum+=tmp;
    }
    solve();
    return 0;
}
