
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	}
} Main public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	} main {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	} int x; x int y; y int z; z Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String num = scan.nextLine(); num scan.nextLine() scan.nextLine scan String[] numbers = num.split(" "); numbers num.split(" ") num.split num " " x = Integer.parseInt(numbers[0]) x Integer.parseInt(numbers[0]) Integer.parseInt Integer numbers[0] numbers 0 y = Integer.parseInt(numbers[1]) y Integer.parseInt(numbers[1]) Integer.parseInt Integer numbers[1] numbers 1 String A = scan.nextLine(); A scan.nextLine() scan.nextLine scan String[] a = A.split(" "); a A.split(" ") A.split A " " for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		} int i=0; int i=0; i 0 i<y i y i++ i++ i {
			x = x-Integer.parseInt(a[i]);
		} {
			x = x-Integer.parseInt(a[i]);
		} x = x-Integer.parseInt(a[i]) x x-Integer.parseInt(a[i]) x Integer.parseInt(a[i]) Integer.parseInt Integer a[i] a i if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		} x<0 x 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(x);
		} System.out.println(x) System.out.println System.out System System.out x String[] args args public class Main {
	public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	}
} public class Main {
	public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	}
} Main

import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		int x;
		int y;
		int z;
		Scanner scan = new Scanner(System.in);
		String num = scan.nextLine();
		String[] numbers = num.split(" ");
		x = Integer.parseInt(numbers[0]);
		y = Integer.parseInt(numbers[1]);
//		z = Integer.parseInt(numbers[2]);

		String A = scan.nextLine();
		String[] a = A.split(" ");

		for(int i=0; i<y; i++) {
			x = x-Integer.parseInt(a[i]);
		}

		if(x<0) {
			System.out.println(-1);
		}else {
			System.out.println(x);
		}

	}
}