#include<math.h>
#include<vector>
using namespace std;

int main() 
{
	long int n, m;
	cin >> n >> m;
	for (int i = 0; i < m;i++) 
	{
		int buf;
		cin >> buf;
		n -= buf;
		if (n <= 0)
			break;
	}

	if (n <= 0)
		cout << -1 << endl;
	else
		cout << n;
	return 0;
}

