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