#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
using ll = long long;

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

    vector<int> A(M);
    rep(i,M) cin >> A[i];

    ll sum = accumulate(A.begin(), A.end(), 0);
    cout << ((N >= sum) ? N - sum : -1) << endl;
}
