import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String l = sc.nextLine(); l sc.nextLine() sc.nextLine sc String[] arr1 = l.split(" "); arr1 l.split(" ") l.split l " " l = sc.nextLine() l sc.nextLine() sc.nextLine sc String[] arr2 = l.split(" "); arr2 l.split(" ") l.split l " " Integer dSum = 0; dSum 0 for(String s : arr2) {
			dSum += Integer.valueOf(s);

		} String s arr2 {
			dSum += Integer.valueOf(s);

		} {
			dSum += Integer.valueOf(s);

		} dSum += Integer.valueOf(s) dSum Integer.valueOf(s) Integer.valueOf Integer s Integer res = Integer.valueOf(arr1[0]) - dSum; res Integer.valueOf(arr1[0]) - dSum Integer.valueOf(arr1[0]) Integer.valueOf Integer arr1[0] arr1 0 dSum System.out.println(res >= 0 ? res : -1) System.out.println System.out System System.out res >= 0 ? res : -1 res >= 0 res 0 res -1 1 sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String l = sc.nextLine();
		String[] arr1 = l.split(" ");
		l = sc.nextLine();
		String[] arr2 = l.split(" ");

		Integer dSum = 0;
		for(String s : arr2) {
			dSum += Integer.valueOf(s);

		}
		Integer res = Integer.valueOf(arr1[0]) - dSum;
		System.out.println(res >= 0 ? res : -1);
		sc.close();
	}
}
