import java .util.*;

public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    }
} import java .util.*; util.* java public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    }
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int useDays = 0; useDays 0 for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	} int i=0; int i=0; i 0 i<M i M i++ i++ i {
	    useDays += sc.nextInt();
	} {
	    useDays += sc.nextInt();
	} useDays += sc.nextInt() useDays sc.nextInt() sc.nextInt sc if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); } useDays > N useDays N System.out.print(-1) System.out.print System.out System System.out -1 1 { System.out.print(N-useDays); } System.out.print(N-useDays) System.out.print System.out System System.out N-useDays N useDays String[] args args public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    }
} public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    }
} Main
import java .util.*;

public class Main {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int useDays = 0;
	for (int i=0; i<M; i++) {
	    useDays += sc.nextInt();
	}
	if (useDays > N) System.out.print(-1);
	else { System.out.print(N-useDays); }
    }
}
