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

typedef long long ll;
#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, m; cin >> n >> m;
	int tot = 0;
	for (int i = 0; i < m; ++i) {
		int a; cin >> a;
		tot += a;
	}
	if (tot > n) cout << -1;
	else cout << n - tot;
}
