#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <numeric>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<long long> A(M, 0);
    for (int i = 0; i < M; ++i) {
        cin >> A[i];
    }

    long long sum = 0ll;
    for (int i = 0; i < M; ++i) {
        sum += A[i];
    }

    long long ans = N - sum;
    if (ans < 0) {
        ans = -1;
    }
    cout << ans << endl;
    //cout << setprecision(15) << endl;
    return 0;
}
