#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define yes "Yes\n"
#define no "No\n"
int m,n;
int i,j,k,l;
int a[10000];
//int a,b,c,d,e,f,g;
//int sum,total;
//long long int ;
//float ;
//double ;
//char a[101],b[101],s[101],t[101],u[101];
int main(void){
    scanf("%d %d",&n,&m);
    k = n;
    for (size_t i = 0; i < m; i++)
    {
        scanf("%d",&a[i]);
        n -= a[i];
    }
    if (n < 0)
    {
        printf("-1\n");
    }else
    {
        printf("%d\n",n);
    }
    
    
    
    return 0;
}