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

int main()
{int n,m;
 scanf("%d%d", &n,&m);
 int a[m];
 int total=0;
 for (int i=0; i<m; ++i)
  { scanf("%d", &a[i]);
    total+=a[i];
  }
 int ho= n-total;
 if (ho<0)
  printf("-1");
 else
  printf("%d", ho);
    return 0;
}
