
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	}

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

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	}

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

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	} main {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int ans=0; ans 0 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++) {
			int A = scanner.nextInt();
			ans = ans + A;
		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
			int A = scanner.nextInt();
			ans = ans + A;
		} {
			int A = scanner.nextInt();
			ans = ans + A;
		} int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner ans = ans + A ans ans + A ans A ans = N - ans ans N - ans N ans if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		} ans >= 0 ans 0 {
			System.out.println(ans);
		} System.out.println(ans) System.out.println System.out System System.out ans {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	}

} Main

import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int ans=0;
		int N = scanner.nextInt();
		int M = scanner.nextInt();
		for(int i=0; i<M; i++) {
			int A = scanner.nextInt();
			ans = ans + A;
		}

		ans = N - ans;
		if(ans >= 0) {
			System.out.println(ans);
		}else {
			System.out.println(-1);
		}

		scanner.close();


	}

}
