#include<stdio.h>

int main(void){
  int n,m;
  int a[m];
  int i,sum,play;
  
  scanf("%d %d",&n,&m);
  i = 0;
  sum = 0;
  while(i<m){
    scanf("%d",&a[i]);
    sum += a[i];
    i++;
  }
  
  if(sum>n){
    printf("-1");
  }
  else{
    play = n - sum;
    printf("%d",play);
  }
  
  return 0;
}