import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	}
} Main public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	} main {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	} Scanner kbs = new Scanner(System.in); kbs new Scanner(System.in) int n n m; m n = kbs.nextInt() n kbs.nextInt() kbs.nextInt kbs m = kbs.nextInt() m kbs.nextInt() kbs.nextInt kbs int s = 0; s 0 for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			int x = kbs.nextInt();
			s = s + x;
		} {
			int x = kbs.nextInt();
			s = s + x;
		} int x = kbs.nextInt(); x kbs.nextInt() kbs.nextInt kbs s = s + x s s + x s x n = n - s n n - s n s if (n < 0) {
			n = -1;
		} n < 0 n 0 {
			n = -1;
		} n = -1 n -1 1 System.out.printf("%d", n) System.out.printf System.out System System.out "%d" n kbs.close() kbs.close kbs String[] args args public class Main {
	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner kbs = new Scanner(System.in);
		int n,m;
		n = kbs.nextInt();
		m = kbs.nextInt();
		int s = 0;
		for(int i = 0;i < m;i++) {
			int x = kbs.nextInt();
			s = s + x;
		}
		n = n - s;
		if (n < 0) {
			n = -1;
		}
		System.out.printf("%d", n);
		kbs.close();
	}
}
