#include <bits/stdc++.h>

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 10005;

int n, m;
int a[N];

int main() {

	FAST;

	cin >> n >> m;
	int sum = 0;
	for (int i = 1; i <= m; i ++) {
		cin >> a[i];
		sum += a[i];
	}
	cout << ((n - sum < 0) ? -1 : (n - sum)) << '\n';
	return 0;
}