#include <iostream>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    long long sum = 0;

    for (int i = 0; i < M; ++i) {
        int Ai;
        cin >> Ai;
        sum += Ai;
    }

    if (N < sum) {
        cout << -1 << endl;
    } else {
        cout << N - sum << endl;
    }

    return 0;
}