#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    ll n, *a, m; cin >> n >> m;   
    a = new ll[m];
    ll s = 0;
    for (int i = 0; i < m; i++) {
        cin >> a[0];
        s+= a[0];
    }

    if (s <= n)
        cout << n-s << endl;
    else 
        cout << -1 << endl;
    return 0;
}