#include <stdio.h>
int main(void){
    // Your code here!
    int x,y,a,b;
    a = 0;
    scanf("%d %d\n", &x,&y);
    for(int i=0;i<y;i++){
        scanf("%d", &b);
        a+=b;
    }
    if(a>x){
    printf("-1");
}
else{
    printf("%d",x-a);
}
        
    }
