import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n = Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int k = Integer.parseInt(str[1]); k Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " long sum = 0; sum 0 for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		} int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
			int a = Integer.parseInt(str[i]);

			sum += a;
		} {
			int a = Integer.parseInt(str[i]);

			sum += a;
		} int a = Integer.parseInt(str[i]); a Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i sum += a sum a if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		} n < sum n sum {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" {
			System.out.println(n - sum);
		} System.out.println(n - sum) System.out.println System.out System System.out n - sum n sum String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

			sum += a;
		}
		if (n < sum) {
			System.out.println("-1");
		} else {
			System.out.println(n - sum);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long sum = 0;
		for (int i = 0; i < k; i++) {
			int a = Integer.parseInt(str[i]);

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