#include <stdio.h>

int main()
{
  int i, j;
  int n, m, sum, a[10000];
  sum = 0;
  
  scanf("%d%d", &n, &m);
  for(i = 0; i < m; i++){
    scanf("%d", &a[i]);
    sum += a[i];
  }
  if(sum <= n){
    printf("%d\n", n - sum);
  }else{
    printf("-1\n");
  }
  
  return 0;
}