import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	}

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

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	} main {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int vacation = scanner.nextInt(); vacation scanner.nextInt() scanner.nextInt scanner int homeworkNumber = scanner.nextInt(); homeworkNumber scanner.nextInt() scanner.nextInt scanner int[] daysSpentInHomework = new int[homeworkNumber]; daysSpentInHomework new int[homeworkNumber] homeworkNumber int studyDay = 0; studyDay 0 for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < homeworkNumber i homeworkNumber i++ i++ i {
			daysSpentInHomework[i] = scanner.nextInt();
		} {
			daysSpentInHomework[i] = scanner.nextInt();
		} daysSpentInHomework[i] = scanner.nextInt() daysSpentInHomework[i] daysSpentInHomework i scanner.nextInt() scanner.nextInt scanner for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		} int j = 0; int j = 0; j 0 j < homeworkNumber j homeworkNumber j++ j++ j {
			studyDay = studyDay + daysSpentInHomework[j];
		} {
			studyDay = studyDay + daysSpentInHomework[j];
		} studyDay = studyDay + daysSpentInHomework[j] studyDay studyDay + daysSpentInHomework[j] studyDay daysSpentInHomework[j] daysSpentInHomework j int playable; playable if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		} vacation - studyDay >= 0 vacation - studyDay vacation studyDay 0 {
			playable = vacation - studyDay;
			System.out.println(playable);
		} playable = vacation - studyDay playable vacation - studyDay vacation studyDay System.out.println(playable) System.out.println System.out System System.out playable {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int vacation = scanner.nextInt();
		int homeworkNumber = scanner.nextInt();
		int[] daysSpentInHomework = new int[homeworkNumber];
		int studyDay = 0;

		for (int i = 0; i < homeworkNumber; i++) {
			daysSpentInHomework[i] = scanner.nextInt();
		}

		for (int j = 0; j < homeworkNumber; j++) {
			studyDay = studyDay + daysSpentInHomework[j];
		}

		int playable;

		if (vacation - studyDay >= 0) {
			playable = vacation - studyDay;
			System.out.println(playable);
		} else {
			System.out.println("-1");
		}

		scanner.close();

	}

}
