#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> A(M);
    ll Sum=0;
    rep(i, M){
        cin>>A[i];
        Sum+=A[i];
    }
    if(N-Sum>=0){
        cout<<N-Sum<<endl;
    }
    else{
        cout<<-1<<endl;
    }

}

