#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,m; cin >> n >> m;
    ll ans = 0;
    rep(i,0,m){
        ll tmp;
        cin >> tmp;
        ans += tmp;
    }
    if(n-ans>=0) cout << n-ans << endl;
    else cout << -1 << endl; 
}