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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    int sum = 0;
    for (int i=0; i< M; i++) {
        int a;
        cin >> a;
        sum += a;
    }
    int nokori = N - sum;
    if (nokori < 0) cout << -1 << endl;
    else cout << nokori << endl;
}
