#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(m);
    ll ans = 0;
    rep(i,0,m-1){
        cin>>a[i];
        ans += a[i];
    }
    if(n>=ans) cout<<n-ans<<endl;
    else cout<<"-1"<<endl;
    return 0;
}