#include <stdio.h>
int main(){
  int n, m, total = 0, num;
  scanf("%d%d", &n, &m);
  for(int i = 0; i < m; i++){
    scanf("%d", &num);
    total += num;
  }
  if(total > n){puts("-1");}
  else{
    printf("%d", n - total);
  }
}