#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int main(){
    int n,m;
    int ai;
    int s = 0;
    cin >> n >> m;
    for(int i=0; i<m; i++){
        cin >> ai;
        s+=ai;
    }
    if(s>n){
        cout << -1 << endl;
    }else{
        cout << n-s << endl;
    }
}