import java.util.Scanner;

public class  Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	}
} import java.util.Scanner; Scanner java.util public class  Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	} main {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			n -= scanner.nextInt();
		} {
			n -= scanner.nextInt();
		} n -= scanner.nextInt() n scanner.nextInt() scanner.nextInt scanner if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		} n < 0 n 0 {
		System.out.print(-1);
		} System.out.print(-1) System.out.print System.out System System.out -1 1 {
			System.out.print(n);
		} System.out.print(n) System.out.print System.out System System.out n String[] args args public class  Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	}
} public class  Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	}
} Main
import java.util.Scanner;

public class  Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		int m = scanner.nextInt();

		for(int i = 0; i < m; i++) {
			n -= scanner.nextInt();
		}

		if(n < 0) {
		System.out.print(-1);
		} else {
			System.out.print(n);
		}
	}
}