import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	} main {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int M = stdIn.nextInt(); M stdIn.nextInt() stdIn.nextInt stdIn int[] A = new int[M]; A new int[M] M for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i ++ i ++ i {
			A[i] = stdIn.nextInt();
		} {
			A[i] = stdIn.nextInt();
		} A[i] = stdIn.nextInt() A[i] A i stdIn.nextInt() stdIn.nextInt stdIn for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i ++ i ++ i {
			N -= A[i];
		} {
			N -= A[i];
		} N -= A[i] N A[i] A i if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		} 0 <= N 0 N {
			System.out.println(N);
		} System.out.println(N) System.out.println System.out System System.out N {
			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) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int i = 0; i < M; i ++) {
			A[i] = stdIn.nextInt();
		}
		for(int i = 0; i < A.length; i ++) {
			N -= A[i];
		}
		if(0 <= N) {
			System.out.println(N);
		}else {
			System.out.println("-1");
		}
	}
}