#include <iostream>
#include <vector>
using namespace std;
int main(){
    int N,M;
    vector<int>A(M);
    cin >> N >> M;
    for(int i=0;i<M;i++){
        cin >> A[i];
        N -= A[i];
    }
    if(N <0){
        cout << -1;
    }else{
        cout << N;
    }

}