#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;


int main(){
    llong n,m,a,sum=0,ans;
    cin >> n >> m;
    rep(i,m){
        cin >> a;
        sum += a;
    }
    ans = n-sum;
    if(ans >= 0){
        cout << ans << endl;
    }else{
        cout << "-1" << endl;
    }
}
