#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

const int INF = 1e9;

int main() {
    int N, M;
    cin >> N >> M;
    int sum = 0;
    for (int i=0;i<M;i++) {
        int A;
        cin >> A;
        sum += A;
    }
    if (N < sum) cout << -1 << "\n";
    else cout << N - sum << "\n";

    return 0;
}