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

int main()
{
    ll n, m;
    cin >> n >> m;
    ll a = 0;
    rep(i, m) {
        ll ai;
        cin >> ai;
        a += ai;
    }
    if (a > n) {
        cout << -1 << endl;
    } else {
        cout << n - a << endl;
    }
    return 0;
}
