import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int aSum = 0; aSum 0 for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			aSum += scan.nextInt();
		} {
			aSum += scan.nextInt();
		} aSum += scan.nextInt() aSum scan.nextInt() scan.nextInt scan if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		} n >= aSum n aSum {
			System.out.println(n - aSum);
		} System.out.println(n - aSum) System.out.println System.out System System.out n - aSum n aSum {
			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 scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int aSum = 0;
		for (int i = 0; i < m; i++) {
			aSum += scan.nextInt();
		}
		if (n >= aSum) {
			System.out.println(n - aSum);
		} else {
			System.out.println(-1);
		}

	}
}