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

int main(void){
    int n,m;
    cin >> n >> m;
    vector<int> vec(m);
    ll task = 0;
    for(int i=0;i<m;i++){
        int n;
        cin >> n;
        task += n;
    }
    if(n<task) cout << -1 << endl;
    else cout << n-task << endl;
}