#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
int a[10010],sum;
int main()
{
	cin >>n>>m;
	for (int i=0;i<m;i++) cin >>a[i],sum+=a[i];
	if (sum>n) cout <<"-1";
	else cout <<n-sum;
	return 0;
}