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