#include <stdio.h>
int main(void){
long int n,m;  //day homework
scanf("%ld %ld",&n,&m);
long int b;
long long int fin=0;
while(fin<n){
  scanf("&ld",&b);
  fin+=b;
  if(fin>n){
    printf("-1");
    return 0;
  }
}

printf("%d",n-fin);


  return 0;
  }