#include <stdio.h>

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

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

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

  return 0;
}
