# include <bits/stdc++.h>

using namespace std;

int main() {
    int m, n;
    cin >> m >> n;
    for (int i = 0, x; i < n; i++) {
        cin >> x;
        m -= x;
    }
    if (m < 0) {
        cout << -1;
    } else {
        cout << m;
    }
}
