#include <bits/stdc++.h>
using namespace std;
#define go(i, a, n) for (ll i = a; i < n; i++)
#define gor(i, a, n) for (int i = n - 1; i >= a; i--)
#define show(x) cout << x << '\n'
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vpair vector<pair<ll, ll>>
#define vtuple vector<tuple<ll, ll, ll>>
#define ff first
#define ss second
#define mod 1000000007
#define memset(a, k) memset(a, k, sizeof(a))
#define answer(z, k) cout << "Case #" << z << ": " << k << endl;
auto t1 = chrono::high_resolution_clock::now();
bool prime[1000001];

ll expo(ll a, ll b)
{
	a = a % mod;
	b = b % mod;
	if (b == 0)
		return 1;
	if (b % 2)
		return ((a % mod) * (expo((a * a) % mod, b / 2) % mod)) % mod;
	return expo((a * a) % mod, b >> 1) % mod;
}

ll mul(ll a, ll b)
{
	a = a % mod;
	b = b % mod;
	if (b == 0)
		return 0;
	if (b % 2)
		return ((a % mod) + (mul((a + a) % mod, b >> 1) % mod)) % mod;
	return mul((a + a) % mod, b >> 1) % mod;
}

bool ispoweroftwo(ll x)
{
	return x && !(x & (x - 1));
}

ll xorcal(ll n)
{
	if (n % 4 == 0)
		return n;
	if (n % 4 == 1)
		return 1;
	if (n % 4 == 2)
		return n + 1;
	if (n % 4 == 3)
		return 0;
}

void sieve(ll n)
{
	memset(prime, true);
	prime[0] = false;
	prime[1] = false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (prime[i] == true)
		{
			for (ll j = i * i; j <= n; j += i)
				prime[j] = false;
		}
	}
}

ll modinverse(ll a, ll m)
{
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m;
		a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

void binary(ll a[], ll n)
{
	gor(i, 0, 64)
	{
		ll k = n >> i;
		a[i] = k & (ll)1;
	}
}

ll countBits(ll n)
{
	if (n == 0)
		return 0;
	return 1 + countBits(n & (n - 1));
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n, m, a, sum = 0;
	cin >> n >> m;
	go(i, 0, m)
	{
		cin >> a;
		sum += a;
	}
	if (n - sum < 0)
		show("-1");
	else
		show(n - sum);
	auto t2 = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(t2 - t1).count();
	clog << "Time taken = " << duration * 1.0 / 1000 << " seconds" << endl;
	return 0;
}
