#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    int sum = 0;
    for(int i=0;i<M;i++){
        int a;
        cin >> a;
        sum += a;
    }
    cout << (sum<=N? N-sum:-1) << "\n";
}