#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n, m; cin>>n>>m;
    ll x, sum = 0;
    loop(m){
        cin>>x;
        sum += x;
    }
    if(x>n) return cout<<"-1\n", 0;
    else cout<<n-sum<<"\n";
    return 0;
}