#include<stdio.h>
#include<math.h>

int main(){
    int n;
    int m;
    scanf("%d %d",&n,&m);
    int sum = 0;
    int a;
    for(int i = 0;i < m;i++){
        scanf("%d",&a);
        sum += a;
    }
    a = n - sum;
    if(a >= 0){
        printf("%d\n",a);
    }else{
        printf("-1\n");
    }
}