#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int m;
    cin>>m;
    int sum = 0;
    for(int i=0;i<m;++i){
        int val;
        cin>>val;
        sum += val;
    }
    if(sum<=n){
        cout<<n-sum<<'\n';
    }
    else{
        cout<<-1<<'\n';
    }
    return 0;
}