#include <iostream>
#include <vector> 
#include <set>
#include <map>
#include <math.h>

using namespace std;

#define loop(i,a,b) for(int i = a; i<b; i++)
#define square(a) (a)*(a)

typedef long long ll;
typedef string str;


int main ()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b;
	cin >> a >>b;
	
	int c[100];
	
	int sum = 0;
	loop(i,0,b)
	{
		cin >> c[i];
		sum += c[i];
	} 
	
	if (a >= sum)
	cout << a - sum;
	else
	cout << -1;
}
