#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int N, M, Q = 0;
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		int A;
		cin >> A;
		Q += A;
	}
	
	if (Q > N) {
		cout << -1 << endl;
	}
	else cout << N - Q << endl;
}