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