#include <stdio.h>

int main(void)
{
  long int n;
  long int m;
  scanf("%ld%ld", &n, &m);
  long int a[m];
  for (long int i=0; i < m; i++)
    scanf("%ld", &a[i]);

  long int sum;
  for (long int i = 0; i < m; i++)
    sum += a[i];

  printf("%ld", (sum <= n) ? (n - sum) : (-1));

  return 0;
}
