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();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}

} 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();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}

} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	} main {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	} 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 int[] A = new int [M]; A new int [M] M for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan for (int i = 0; i < M; i++) {
			N -= A[i];
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			N -= A[i];
		} {
			N -= A[i];
		} N -= A[i] N A[i] A i if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		} N < 0 N 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(N);
		} System.out.println(N) System.out.println System.out System System.out N 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();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}

} 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();
		int[] A = new int [M];
		for (int i = 0; i < M; i++) {
			A[i] = scan.nextInt();
		}

		for (int i = 0; i < M; i++) {
			N -= A[i];
		}

		if (N < 0) {
			System.out.println(-1);
		} else {
			System.out.println(N);
		}
	}

}