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

int main()
{
    ll N,M;
    cin >> N >> M;
    ll sum = 0;

    for(ll i = 0; i < M; i++)
    {
        ll tmp;
        cin >> tmp;
        sum += tmp;
    }

    if(sum > N)cout << -1 << endl;
    else cout << N - sum << endl;
    return 0;
}