#include <bits/stdc++.h>

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    int a;
    int sum = 0;
    rep(0, m) {
        cin >> a;
        sum += a;
    }

    if (sum <= n) {
        cout << (n - sum);
    } else {
        cout << -1;
    }
    cout << endl;

    return 0;
}
