#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


int main(int argc, char **argv) {
    int n, m;
    cin >> n >> m;

    std::vector<int> as(m,0);
    int sum{0};
    for (int i=0; i<m; ++i) {
        cin >> as[i];
        sum+=as[i];
    }

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

    return 0;
}