import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

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

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

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

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	} main {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] temp = scanner.nextLine().split(" "); temp scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int n = Integer.parseInt(temp[0]); n Integer.parseInt(temp[0]) Integer.parseInt Integer temp[0] temp 0 int m = Integer.parseInt(temp[1]); m Integer.parseInt(temp[1]) Integer.parseInt Integer temp[1] temp 1 int sum = 0; sum 0 String[] tempList = scanner.nextLine().split(" "); tempList scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " int[] list = new int[m]; list new int[m] m for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		} int i= 0; int i= 0; i 0 i < m i m i++ i++ i {
			list[i] = Integer.parseInt(tempList[i]);
		} {
			list[i] = Integer.parseInt(tempList[i]);
		} list[i] = Integer.parseInt(tempList[i]) list[i] list i Integer.parseInt(tempList[i]) Integer.parseInt Integer tempList[i] tempList i for(int value : list) {
			sum += value;
		} int value list {
			sum += value;
		} {
			sum += value;
		} sum += value sum value if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		} sum <= n sum n {
			System.out.println(n - sum);
		} System.out.println(n - sum) System.out.println System.out System System.out n - sum n sum {
			System.out.println( -1);
		} System.out.println( -1) System.out.println System.out System System.out -1 1 String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String[] temp = scanner.nextLine().split(" ");
		int n = Integer.parseInt(temp[0]);
		int m = Integer.parseInt(temp[1]);
		int sum = 0;
		String[] tempList = scanner.nextLine().split(" ");
		int[] list = new int[m];
		for(int i= 0; i < m; i++) {
			list[i] = Integer.parseInt(tempList[i]);
		}

		for(int value : list) {
			sum += value;
		}

		if(sum <= n) {
			System.out.println(n - sum);
		}else{
			System.out.println( -1);
		}

	}

}