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



int main(){
    ll N, M; cin >> N >> M;
    ll SUM = 0;
    for(int i = 0; i < M; i++){
        ll a; cin >> a;
        SUM += a;
    }
    if(N < SUM) cout << -1 << endl;
    else cout << N - SUM << endl;
}