#include<iostream>
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define N 2*10e5
using namespace std;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,m;
	cin>>n>>m;
	ll arr[m],sum=0;
	for(int i=0;i<m;i++)
	cin>>arr[i] , sum+=arr[i];
	if(sum>n)
	cout<<"-1";
	else
	cout<<n-sum;
}

