#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    ll sum = 0;
    rep(i,M) {
        cin >> A.at(i);
        sum += A[i];
    }
    if (N - sum >= 0) {
        cout << N - sum << endl;
    } else {
        cout << -1 << endl;
    }
}