#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> v(m);
    ll sum = 0;
    rep(i,m){
        ll a;
        cin>>a;
        sum+=a;
    }
    if(sum>n) cout<<"-1"<<endl;
    else cout<<n-sum<<endl;
    return 0;
}