import java.util.Scanner;
public class Main {

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

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

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

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

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

} public class Main {

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

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

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

}