#include <stdio.h>

int main (){
  int N,M,i;
  scanf("%d %d",&N,&M);
  int A[M],sum = 0;
  for(i = 0;M > i;i++){
	scanf("%d",&A[i]);
    sum = sum + A[i];
  }
  if(sum > N){
    printf("-1");
  }else{
    printf("%d",N-sum);
  }
  return 0;
}
