#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <math.h>
#include <algorithm>
#include <queue>

using namespace std;
int main()
{
    int N, M;
    int day = 0;

    cin >> N >> M;
    vector<int> shukulist( M );

    for (auto i = 0; i < M; i++) 
    {
        cin >> shukulist[i];
        day += shukulist[i];
    }
    if (N < day) {
        cout << "-1" << endl;
    } else {
        cout << (N - day) << endl;
    }
    
    return 0;
}
