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();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

	}
} 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();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

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

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

	} main {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

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

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

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

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

	}
} 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();

		Integer[] aList = new Integer[M];
		for (int i = 0; i < M; i++) {
			int a = scan.nextInt();
			aList[i] = a;
		}

		int wDay = 0;
		for (int i = 0; i < aList.length; i++) {
			wDay = wDay + aList[i];
		}

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

	}
}
