import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	

	
	
	public static void main(String[] args) {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	}
} import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Scanner; Scanner java.util public class Main {
	

	
	
	public static void main(String[] args) {

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

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	} main {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int m = s.nextInt(); m s.nextInt() s.nextInt s int sum=0; sum 0 for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			sum+=s.nextInt();
		} {
			sum+=s.nextInt();
		} sum+=s.nextInt() sum s.nextInt() s.nextInt s 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 String[] args args public class Main {
	

	
	
	public static void main(String[] args) {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	}
} public class Main {
	

	
	
	public static void main(String[] args) {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	}
} Main
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	

	
	
	public static void main(String[] args) {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	}
}