#include <iostream>

using namespace std;

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