//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    ll tmp = 0;
    REP(i, m) {
        cin >> a[i];
        tmp += a[i];
    }
    if(tmp > n) 
        cout <<  -1 << endl;
    else 
        cout << n - tmp << endl;
    return 0;
}