import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	}

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

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	}

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

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc ArrayList<Integer> array = new ArrayList<Integer>(); array new ArrayList<Integer>() Integer sum = 0; sum 0 int x = 0; x 0 while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		} sc.hasNext() sc.hasNext sc {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		} Integer a = sc.nextInt(); a sc.nextInt() sc.nextInt sc sum += a sum a array.add(a) array.add array a if(sum > n) {
			System.out.println(-1);
		} else {
			System.out.println(n - sum);
		} sum > n sum n {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(n - sum);
		} System.out.println(n - sum) System.out.println System.out System System.out n - sum n sum sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	}

} Main
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		ArrayList<Integer> array = new ArrayList<Integer>();
		Integer sum = 0;
		int x = 0;
		
		while(sc.hasNext()) {
			Integer a = sc.nextInt();
			sum += a;
			array.add(a);
		}

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

		sc.close();

	}

}