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