import java.util.Scanner;

public class Main {

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

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

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

	public static void main(String[] args) {
		Scanner a = new Scanner(System.in);		
		int N = a.nextInt();
		int M = a.nextInt();
		Integer[] MArray = new Integer[M];
		for(int i = 0; i < M ; i++) {
			MArray[i] = a.nextInt();
			N -= MArray[i];
		}
		if(N < 0) {
			System.out.println("-1");
		}else {
			System.out.println(N);
		}
	}
} Main
import java.util.Scanner;

public class Main {

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