#include <bits/stdc++.h>
using namespace std;

#define     ll      long long int

int main( )
{
    ll n, m, i, j, s = 0;
    cin >> n >> m;
    for (i = 1; i <= m; i++) {
        cin >> j;
        s += j;
    }
    if (s > n) {
        cout << "-1\n";
    }
    else {
        cout << (n - s) << '\n';
    }
    return 0;
}
