#include <stdio.h>

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