#include <bits/stdc++.h>
using namespace std;
#define ll long long

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 (sum > N) cout << -1 << endl;
    else cout << N-sum << endl;
    return 0;
}