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 sum = 0;
		for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		}
		if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		}

	}
	
} 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 sum = 0;
		for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		}
		if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		}

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

	} main {
	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		}
		if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		}

	} 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 sum = 0; sum 0 for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			sum += sc.nextInt();
		} {
			sum += sc.nextInt();
		} sum += sc.nextInt() sum sc.nextInt() sc.nextInt sc if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		} N - sum >= 0 N - sum N sum 0 {
			System.out.println(N - sum);
		} System.out.println(N - sum) System.out.println System.out System System.out N - sum N sum {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 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 sum = 0;
		for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		}
		if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		}

	}
	
} public class Main {

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

	}
	
} 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 sum = 0;
		for(int i = 0; i < M; i++) {
			sum += sc.nextInt();
		}
		if(N - sum >= 0) {
			System.out.println(N - sum);
		} else {
			System.out.println(-1);
		}

	}
	
}