#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,M,count;
    count = 0;
    cin >> N >> M;
    for(int i=0;i<M;i++){
    int a;
    cin >> a;
    count +=a;
    }
    if(N>=count)
    cout << N-count << endl;
    else
    cout << -1 << endl;
}