//abc163_b.cpp
//Sun Apr 19 20:58:04 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,m;
	cin >> n >> m;

	int a[m];
	for (int i=0;i<m;i++){
		int a;
		cin >> a;
		n = n-a;
	}

	if (n<0){
		cout << "-1" << endl;
	}else {
		cout << n << endl;
	}

}