import java.util.*;

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

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