#include<stdio.h>

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