import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

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

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

	} main {

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int day = sc.nextInt(); day sc.nextInt() sc.nextInt sc int work_count = sc.nextInt(); work_count sc.nextInt() sc.nextInt sc int homework [] = new int[work_count]; homework new int[work_count] work_count for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < work_count i work_count i++ i++ i {
			homework[i] = sc.nextInt();
		} {
			homework[i] = sc.nextInt();
		} homework[i] = sc.nextInt() homework[i] homework i sc.nextInt() sc.nextInt sc int sum = 0; sum 0 for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		} int i = 0; int i = 0; i 0 i < work_count i work_count i++ i++ i {
			sum += homework[i];
		} {
			sum += homework[i];
		} sum += homework[i] sum homework[i] homework i if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		} day >= sum day sum {
			System.out.print(day - sum);
		} System.out.print(day - sum) System.out.print System.out System System.out day - sum day sum {
			System.out.print(-1);
		} System.out.print(-1) System.out.print System.out System System.out -1 1 return; String[] args args public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

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

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

	}
} Main
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		int day = sc.nextInt();
		int work_count = sc.nextInt();

		int homework [] = new int[work_count];

		for (int i = 0; i < work_count; i++) {
			homework[i] = sc.nextInt();
		}

		int sum = 0;

		for (int i = 0; i < work_count; i++) {
			sum += homework[i];
		}

		if (day >= sum) {
			System.out.print(day - sum);
		} else {
			System.out.print(-1);
		}

	return;

	}
}
