#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<ll, ll>;

int main(int argc, char **argv)
{
	ll N, M; cin >> N >> M;
	vector<ll> A(M);
	for (ll i = 0; i < M; ++i) cin >> A[i];
	if (N - accumulate(A.begin(), A.end(), 0ll) >= 0)
		std::cout << (N - accumulate(A.begin(), A.end(), 0ll))<< std::endl;
	else
		std::cout << -1 << std::endl;
}