import java.util.*;
public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	}
} Main public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	} main {
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	} Scanner ob = new Scanner(System.in); ob new Scanner(System.in) int N = ob.nextInt(); N ob.nextInt() ob.nextInt ob int M = ob.nextInt(); M ob.nextInt() ob.nextInt ob int R = 0; R 0 int[] array = new int[M]; array new int[M] M for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			array[i] = ob.nextInt();
		} {
			array[i] = ob.nextInt();
		} array[i] = ob.nextInt() array[i] array i ob.nextInt() ob.nextInt ob for(int j = 0; j < M; j++){
			R += array[j]; 
		} int j = 0; int j = 0; j 0 j < M j M j++ j++ j {
			R += array[j]; 
		} {
			R += array[j]; 
		} R += array[j] R array[j] array j if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		} (N - R) < 0 (N - R) N R 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(N - R);
		} System.out.println(N - R) System.out.println System.out System System.out N - R N R String args[] args public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	}
} public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	}
} Main
import java.util.*;
public class Main{
	public static void main(String args[]){
		
		Scanner ob = new Scanner(System.in);
		int N = ob.nextInt();
		int M = ob.nextInt();
		int R = 0;

		int[] array = new int[M];
		for(int i = 0; i < M; i++){
			array[i] = ob.nextInt();
		}

		for(int j = 0; j < M; j++){
			R += array[j]; 
		}

		if((N - R) < 0){
			System.out.println(-1);
		}
		else{
			System.out.println(N - R);
		}
	}
}
