#include <iostream>

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;

int main(){
    int N, M;
    cin >> N >> M;

    int A[M];
    for(int i=0; i<M; i++){
        cin >> A[i];
    }

    long sum = 0;
    for(int i=0; i<M; i++){
        sum = sum + (long long)A[i];
    }

    if(sum <= N) cout << N-sum << endl;
    else cout << -1 << endl;

    return 0;
}
