import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	}

} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	}

} Main public static void main(String[] args) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	} main {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}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 homework =0; homework 0 for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			} int i=0; int i=0; i 0 i<M i M i++ i++ i {
				homework+= sc.nextInt();
			} {
				homework+= sc.nextInt();
			} homework+= sc.nextInt() homework sc.nextInt() sc.nextInt sc int ans = N - homework; ans N - homework N homework if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			} ans >=0 ans 0 {
				System.out.println(ans);
			} System.out.println(ans) System.out.println System.out System System.out ans {
				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) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	}

} public class Main {

	public static void main(String[] args) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	}

} Main
import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//			String W = in.readLine();
//
//			int N= Integer.parseInt(W.split(" ")[0]);
//			int M= Integer.parseInt(W.split(" ")[1]);
		Scanner sc = new Scanner(System.in);
			int N  = sc.nextInt();
			int M= sc.nextInt();
//			int[] A = new int[M];
			int homework =0;

			for(int i=0;i<M;i++) {
				homework+= sc.nextInt();
			}

			int ans = N - homework;

			if(ans >=0) {
				System.out.println(ans);
			}else {
				System.out.println(-1);
			}

	}

}
