//package atcoder;
 
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	} 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 A[] = new int [M]; A new int [M] M for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
			A[i] = sc.nextInt();
		} {
			A[i] = sc.nextInt();
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int finish = 0; finish 0 for(int j=0;j<M;j++) {
			finish = finish+A[j];
		} int j=0; int j=0; j 0 j<M j M j++ j++ j {
			finish = finish+A[j];
		} {
			finish = finish+A[j];
		} finish = finish+A[j] finish finish+A[j] finish A[j] A j if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		} finish>N finish N {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(N-finish);
		} System.out.println(N-finish) System.out.println System.out System System.out N-finish N finish String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	}
} Main
//package atcoder;
 
import java.util.*;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int A[] = new int [M];
		for(int i=0;i<M;i++) {
			A[i] = sc.nextInt();
		}
		int finish = 0;
		for(int j=0;j<M;j++) {
			finish = finish+A[j];
		}
		if(finish>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-finish);
		}
		
	}
}
