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