#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n, m;
	cin >> n >> m;
	int sum = 0;
	for (int i = 0; i < m; i++){
		int a;
		cin >> a;
		sum += a;
	}
	if (n >= sum) cout << n-sum << endl;
	else cout << -1 << endl;
	return 0;
}