#include <cstdio>
#include <cstring>

using namespace std;

#define ll long long

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	ll sum = 0;
	for (int i = 0; i < m; i++) {
		int x;
		scanf("%d", &x);
		sum += x;
	}
	if (sum > n)
		puts("-1");
	else
		printf("%lld\n", n - sum);

	return 0;
}