#include <stdio.h>

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

    long sum = 0;

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

    long ans;
    if(n-sum>=0)
    ans = n-sum;
    else
    ans = -1;

    printf("%ld", ans);

    return 0;
}