
// Problem : B - Homework
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n, m;
	cin >> n >> m;
	long long tot = 0;
	for(int i = 0; i < m; i++) {
		int x; cin >> x;
		tot += x;
	}
	long long ans = n - tot;
	if(ans < 0) {
		ans = -1;
	}
	cout << ans << '\n';
				
	return 0;
}
