#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    rep(i,m){
        ll a;
        cin>>a;
        sum+=a;
    }

    if(sum>n) cout<<-1<<endl;
    else cout<<n-sum<<endl;
}
