import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int day; day int num; num int[] array; array day = scan.nextInt() day scan.nextInt() scan.nextInt scan num = scan.nextInt() num scan.nextInt() scan.nextInt scan array = new int[num] array new int[num] num int n = 0; n 0 while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		} n < array.length n array.length array array.length {
			array[n] = scan.nextInt();
			n++;
		} array[n] = scan.nextInt() array[n] array n scan.nextInt() scan.nextInt scan n++ n int sum = 0; sum 0 for(int i = 0; i < array.length; i++) {
			sum += array[i];
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
			sum += array[i];
		} {
			sum += array[i];
		} sum += array[i] sum array[i] array i int minus = day - sum; minus day - sum day sum if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		} minus < 0 minus 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(minus);
		} System.out.println(minus) System.out.println System.out System System.out minus String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int day;
		int num;
		int[] array;

		day = scan.nextInt();
		num = scan.nextInt();

		array = new int[num];

		int n = 0;
		while(n < array.length) {
			array[n] = scan.nextInt();
			n++;
		}

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

		int minus = day - sum;
		if(minus < 0) {
			System.out.println(-1);
		} else {
			System.out.println(minus);
		}
	}
}
