import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		for (int i = 0; i < K; i++) {

			N -= sc.nextInt();
		}
		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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		for (int i = 0; i < K; i++) {

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

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

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

			N -= sc.nextInt();
		} int i = 0; int i = 0; i 0 i < K i K i++ i++ i {

			N -= sc.nextInt();
		} {

			N -= sc.nextInt();
		} N -= sc.nextInt() N sc.nextInt() sc.nextInt sc 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 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		for (int i = 0; i < K; i++) {

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

			N -= sc.nextInt();
		}
		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) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		for (int i = 0; i < K; i++) {

			N -= sc.nextInt();
		}
		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}
}