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