import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			N = N - scan.nextInt();
		} {
			N = N - scan.nextInt();
		} N = N - scan.nextInt() N N - scan.nextInt() N scan.nextInt() scan.nextInt scan if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		} N >= 0 N 0 {
			System.out.println(N);
		} System.out.println(N) System.out.println System.out System System.out N {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();

		for (int i = 0; i < M; i++) {
			N = N - scan.nextInt();
		}

		if (N >= 0) {
			System.out.println(N);
		} else {
			System.out.println("-1");
		}
		scan.close();
	}
}
