#include <iostream>
using namespace std;

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

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