#include<stdio.h>

int main(){
  int sumvac,homework;
  int allhlong=0;
  int i;
  
  scanf("%d %d",&sumvac,&homework);
  int hlong[homework];
  for(i=0;i<homework;i++)
    scanf("%d",&hlong[i]);

  for(i=0;i<homework;i++)
    allhlong=allhlong+hlong[i];

  if(allhlong<=sumvac)
    printf("%d",sumvac-allhlong);
  else
    printf("-1");
}