#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,m,A[200001];
    cin>>n>>m;
    rep(i,m) cin>>A[i];
    ll sum=0;
    rep(i,m) sum+=A[i];
    if(sum>n) cout<<-1;
    else cout<<n-sum;
}

