import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	}

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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	}

} Main public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	} main {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int a = s.nextInt(); a s.nextInt() s.nextInt s int b = s.nextInt(); b s.nextInt() s.nextInt s int c = 0; c 0 for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		} int i = 0; int i = 0; i 0 i < b i b i++ i++ i {
			c += s.nextInt();
		} {
			c += s.nextInt();
		} c += s.nextInt() c s.nextInt() s.nextInt s if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		} a < c a c {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(a - c);
		} System.out.println(a - c) System.out.println System.out System System.out a - c a c String[] args args public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = 0;
		for (int i = 0; i < b ;i++) {
			c += s.nextInt();
		}

		if(a < c) {
			System.out.println(-1);
		} else {
			System.out.println(a - c);
		}

	}

}
