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

ll solve() {
    ll N, M, a, s = 0;
    cin >> N >> M;
    vector<ll> A(M);
    for ( int i = 0; i < M; i++ ) {
        cin >> a;
        s += a;
    }
    if ( s > N ) return -1;
    return N-s;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}