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

int main()
{
    int M, N, tmp;
    cin >> N >> M;
    int count = 0;
    for (int i = 0; i < M; i++)
    {
        cin >> tmp;
        count += tmp;
    }

    if (count > N)
        cout << -1;
    else
        cout << N - count;
}