/*
	Roll no : 18EC10057
	PC No.:   70
*/


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define tr(container, it)	for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define len 200005
#define NUM 998244353
#define ll long long int
ll arr[len];
ll max1[len];
struct node
{
	int val;
	node *right;
	node *left;
	node *parent;
};
struct item
{
	int weight;
	int val;
};

bool compare(item a, item b) 
{ 

    if (a.weight != b.weight ) 
        return a.weight < b.weight; 
  	else
  		return a.val>b.val;
} 
node* readtree()
{
	int x,lcnt,rcnt;
	cin>>x>>lcnt>>rcnt;
	node *root=new node;
	root->val=x;
	root->right=NULL;
	root->left=NULL;
	if(lcnt!=0)
		root->left=readtree();
	if(rcnt!=0)
		root->right=readtree();
	return root;
}
void prn_preorder(node *x)
{
	if(x==NULL)
		return;
	cout<<x->val;
	cout<<"  ";
	prn_preorder(x->left);
	prn_preorder(x->right);
}
void prn_inorder(node *x)
{
	if(x==NULL)
		return;
	prn_inorder(x->left);
	cout<<x->val;
	cout<<"  ";
	prn_inorder(x->right);
	if(x->left!=NULL)
		x->left->parent=x;
	if(x->right!=NULL)
		x->right->parent=x;
}
void swapchild(node *x)
{
 	node *temp;
	temp=x->right;
	x->right=x->left;
	x->left=temp;
}
node* rrotate(node *x)
{
	//

	//node *u=x-left->left;
	node *temp=x->parent;
	node *q=x->left;
	node *v=x->left->right;
	q->right=x;
	x->left=v;
	if(v!=NULL)
		v->parent=x;
	q->parent=temp;
	x->parent=q;
	return q;
}
node* lrotate(node *x)
{
	//

	//node *u=x-left->left;
	node *temp=x->parent;
	node *p=x->right;;
	node *v=x->right->left;
	p->left=x;
	x->right=v;
	if(v!=NULL)
		v->parent=x;
	p->parent=temp;
	x->parent=p;
	return p;
}

int binarySearch(ll arr[], int l, int r, ll x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
  
        // If the element is present at the middle 
        // itself 
        if (arr[mid] == x) 
            return mid; 
  
        // If element is smaller than mid, then 
        // it can only be present in left subarray 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
  
        // Else the element can only be present 
        // in right subarray 
        return binarySearch(arr, mid + 1, r, x); 
    } 
  
    // We reach here when element is not 
    // present in array 
    return -1; 
} 
// Function to return the 
// maximum xor 
int max_xor(int arr[], int n) 
{ 
    int maxx = 0, mask = 0; 
  
    set<int> se; 
  
    for (int i = 30; i >= 0; i--)
    { 
  
        // set the i'th bit in mask 
        // like 100000, 110000, 111000.. 
        mask |= (1 << i); 
  
        for (int i = 0; i < n; ++i)
        { 
  
            // Just keep the prefix till 
            // i'th bit neglecting all 
            // the bit's after i'th bit 
            se.insert(arr[i] & mask); 
        } 
  
        int newMaxx = maxx | (1 << i); 
  
        for (int prefix : se)
        { 
  
            // find two pair in set 
            // such that a^b = newMaxx 
            // which is the highest 
            // possible bit can be obtained 
            if (se.count(newMaxx ^ prefix))
            { 
                maxx = newMaxx; 
                break; 
            } 
        } 
  
        // clear the set for next 
        // iteration 
        se.clear(); 
    } 
  
    return maxx; 
} 

int minXOR(int arr[], int n) 
{ 
    // Sort given array 
    sort(arr, arr + n); 
  
    int minXor = INT_MAX; 
    int val = 0; 
  
    // calculate min xor of consecutive pairs 
    for (int i = 0; i < n - 1; i++) { 
        val = arr[i] ^ arr[i + 1]; 
        minXor = min(minXor, val); 
    } 
  
    return minXor; 
} 
vector<ll> v[len];
ll level;
ll dfs(ll x,ll p)
{
	if((v[x].size()==1)&&(x!=1))
	{
		max1[x]=0;
		return max1[x];
	}
	else
	{
		ll ans=0;
		for(int i=0;i<v[x].size();i++)
		{
			if(v[x][i]!=p)
			{	
				ans+=1+dfs(v[x][i],x);
			}
		}
		max1[x]=ans;
		return max1[x];
	}
}
int main()
{
	//cout<<power(2,NUM-2,NUM)<<endl;
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);    
    int n,m;
    cin>>n>>m;
    int sum=0;
    for(int i=0;i<m;i++)
   	{
   		int x;
   		cin>>x;
   		sum+=x;
   	}
   	if(sum>n)
   		cout<<"-1"<<endl;
   	else
   		cout<<n-sum<<endl;

}


Measured memory_bytes: 8364