import java.util.*;
class Main {
public static void main(String []args) {
	Scanner sc = new Scanner (System.in);
	int n=sc.nextInt();
	int m=sc.nextInt();
	int arr[]=new int [m];
	for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	}
	for(int i=0;i<m;i++) {
		n=n-arr[i];
	}
	if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	}
}
} import java.util.*; util.* java class Main {
public static void main(String []args) {
	Scanner sc = new Scanner (System.in);
	int n=sc.nextInt();
	int m=sc.nextInt();
	int arr[]=new int [m];
	for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	}
	for(int i=0;i<m;i++) {
		n=n-arr[i];
	}
	if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	}
}
} Main public static void main(String []args) {
	Scanner sc = new Scanner (System.in);
	int n=sc.nextInt();
	int m=sc.nextInt();
	int arr[]=new int [m];
	for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	}
	for(int i=0;i<m;i++) {
		n=n-arr[i];
	}
	if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	}
} main {
	Scanner sc = new Scanner (System.in);
	int n=sc.nextInt();
	int m=sc.nextInt();
	int arr[]=new int [m];
	for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	}
	for(int i=0;i<m;i++) {
		n=n-arr[i];
	}
	if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	}
} 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 int arr[]=new int [m]; arr new int [m] m for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	} int i=0; int i=0; i 0 i<m i m i++ i++ i {
		arr[i]=sc.nextInt();
	} {
		arr[i]=sc.nextInt();
	} arr[i]=sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc for(int i=0;i<m;i++) {
		n=n-arr[i];
	} int i=0; int i=0; i 0 i<m i m i++ i++ i {
		n=n-arr[i];
	} {
		n=n-arr[i];
	} n=n-arr[i] n n-arr[i] n arr[i] arr i if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	} n>=0 n 0 {
		System.out.println(n);
	} System.out.println(n) System.out.println System.out System System.out n {
		System.out.println("-1");
	} System.out.println("-1") System.out.println System.out System System.out "-1" String []args args
import java.util.*;
class Main {
public static void main(String []args) {
	Scanner sc = new Scanner (System.in);
	int n=sc.nextInt();
	int m=sc.nextInt();
	int arr[]=new int [m];
	for(int i=0;i<m;i++) {
		arr[i]=sc.nextInt();
	}
	for(int i=0;i<m;i++) {
		n=n-arr[i];
	}
	if(n>=0) {
		System.out.println(n);
	}
	else {
		System.out.println("-1");
	}
}
}
