#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI 3.14159265359

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N,M, A, res = 0;
	
	cin >> N >> M;
	while (M--){
		cin >> A;
		res += A;
	}
	if ((N-res) >= 0) cout<< N-res;
	else cout << -1;
}