#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int main(){

    int n,m;
    cin>> n>> m;
    std::vector<int> v;
    int s = 0,x;
    for(int i = 0;i < m;i++){
        cin>> x;
        v.push_back(x);
    }
    for(int x: v){
        //cout<< x;
        s+= x;
    }
    if(s > n)
        cout<< "-1\n";
    else
        cout<< (n - s)<<endl;
}