import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	} main {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

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

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int d = 0;

		for (int i = 0; i < b; i++) {
			int c = input.nextInt();
			d = a - c;
			a = d;
		}

		if (d < 0) {
			d = -1;
		}
		System.out.println(d);
	}
}