#include<stdio.h>
int main(void)
{
int n,m,a[10000],sum,i;
sum = 0;
scanf("%d %d",&n,&m);
for(i=0;i<=m;i++){
  scanf("%d",&a[i]);
  sum += a[i];
}
if(n<sum)
	printf("-1");
else
	printf("%d",n - sum);
return 0;
}