#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int n, m, a;
  scanf("%d %d",&n,&m);
  for (int i = 0; i < m; ++i)
  {
    scanf("%d",&a);
    n = n - a;
    if (n < 0) {
      printf("-1\n");
      exit(0);
    }
  }
  printf("%d\n",n);
  return 0;
}