#include <iostream>
using namespace std;
int main()
{
    int n, m, a, sum = 0;
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        cin >> a;
        sum += a;
    }
    cout << (n - sum < 0 ? -1 : n - sum) << endl;
    return 0;
}