import java.util.*;

public class Main {

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
}

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

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
}

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

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
} main {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
} Scanner s = new Scanner(System.in); s new Scanner(System.in) int m = s.nextInt(); m s.nextInt() s.nextInt s int n = s.nextInt(); n s.nextInt() s.nextInt s ArrayList<Integer> arr = new ArrayList<Integer>(); arr new ArrayList<Integer>() int sum = 0; sum 0 for (int i = 0; i < n; i++)
			sum += s.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i sum += s.nextInt(); sum += s.nextInt() sum s.nextInt() s.nextInt s if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum); sum > m sum m System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(m - sum) System.out.println System.out System System.out m - sum m sum String[] args args public class Main {

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
}

} public class Main {

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {

	Scanner s = new Scanner(System.in);
		int m = s.nextInt();
		int n = s.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>();
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += s.nextInt();

		if (sum > m)
			System.out.println(-1);
		else
			System.out.println(m - sum);
}

}
