#include <stdio.h>

int main(){
  int n;
  int m;
  int count = 0;
  int *homework;
  int result;
  scanf("%d", &n);
  scanf("%d", &m);
  homework = (int*)malloc(sizeof(int) * m);
  
  for(int i = 0; i < m; i++){
    scanf("%d", &homework[i]);
    count = count + homework[i];
  };
  
  result = n - count;
  
  if(result < 0){
    printf("-1");
  }else{
    printf("%d", result);
  };
  
  return 0; 
}