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