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

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