#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;
    
int main(void){

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

}