#include <algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;


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

    


    






































































































































