#include <stdio.h>

int main() {

    int N, M;
    int A[10000];

    int i;

    int homeworkday;
    int answer;

scanf("%d %d", &N, &M);

for(i = 0; i < M; i++) {
scanf("%d", &A[i]);

homeworkday += A[i];
}
    
answer = N - homeworkday;

if(answer < 0) printf("-1\n");
else printf("%d\n", answer);

return 0;

}