#include <stdio.h>
int main(){
  long n,m,a,total=0;
  int i,j,k;
  
  scanf("%ld %ld",&n,&m);
  for(i=0;i<m;i++){
    scanf("%ld",&a);
    total+=a;
  }
  
  if(n-total<0){
    printf("-1");
  } else {
    printf("%ld",n-total);
  }
}  
