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

int main(){
    bool b1 = true;
    int N, M, A;
    A = 0;
    cin >> N >> M;

    vector<int> vec(M);
    for (int i = 0; i < M; i++){
        cin >> vec.at(i);
    }

    for (int i = 0; i < M; i++){
        A = A + vec.at(i);
    }

    if (A > N)
        b1 = false;
    
    if (b1){
        cout << N - A << endl;
    }else{
        cout << -1 << endl;
    }
            
    }

