#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)


int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int a[m];
    long sum=0;
    F(i,0,m){
        scanf("%d",a+i);
        sum+=a[i];
    }
    if(sum<=n){
        printf("%d\n",n-sum);
    }else printf("-1");
    return 0;
}