//Codes by: Umar Bin Qamar

#include <stdio.h>


int main(){


  int n,m;
  scanf("%d%d",&n,&m);
  int arr[m];
  for(int i=0;i<m;i++){
    scanf("%d",&arr[i]);
  }
  int count=0;
for(int i=0;i<m;i++){
    count=count+arr[i];
}
if(count>n){
    printf("-1\n");
}
else{
    printf("%d\n",n-count);
}
    return 0;
}



