#include<stdio.h>
#define PI 3.141592

int main(){
        int N,M;
        scanf("%d %d",&N,&M);

        int a[M];

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

        int totalneed=0;
        for(i=0;i<M;i++){
                totalneed = totalneed + a[i];
        }


        int ans;
        if(totalneed > N){
                printf("-1");
        }
        else{
                ans = N - totalneed;
                printf("%d",ans);
        }


}    