#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long ll;




int main(){
    ll n,m;cin>>n>>m;
    ll sum=0;
    rep(i,0,m){
        ll a;cin>>a;
        sum+=a;
    }
    if(sum<=n)cout<<n-sum<<endl;
    else cout<<-1<<endl;
}
    







