#include<stdio.h>

#include<string.h>

#include<math.h>

int main(){

int n;

int m;

scanf("%d%d ",&n,&m);



int a[m],sum=0;

for(int b=0;b<m;b++){

 scanf("%d",&a[b]);

 sum+=a[b];}



if(sum<=n)

 printf("%d\n",n-sum);



else

 puts("-1\n");



return 0;}