import java.util.*;
import java.lang.Math;

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

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