#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 N,M;
    cin>>N>>M;
    vector<int64> A(M);
    int64 sum=0;
    for (int64 i = 0; i < M; i++)
    {
        cin>>A[i];
        sum+=A[i];
    }
    if(sum>N){
        cout<<-1<<endl;
    }else{
        cout<<N-sum<<endl;
    }
    return 0;
}