#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = (ll)1e15;

int main(void)
{
	ll n, m;
	cin >> n >> m;
	vector<ll> as(m);
	rep(i, m) cin >> as[i];
	ll sum = 0;
	rep(i, m) sum += as[i];
	if (n < sum) {
		cout << -1 << endl;
	}
	else {
		cout << n - sum << endl;
	}
	return 0;
}
