#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

//i*2^X>=K
//2^X>=
int main() {
	int N, M, t = 0, ans=0;
	cin >> N >> M;
	for (size_t i = 0; i < M; i++)
	{

		cin >> t;
		ans += t;
	}
	if (ans <= N)cout << N - ans;
	else cout << -1;
}