import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	}

} import java.util.Scanner; Scanner 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 sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	} 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 sum = 0; sum 0 int x[] = new int[M]; x new int[M] M for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		} int i = 0; int i = 0; i 0 i<M i M i++ i++ i {
			x[i] =sc.nextInt();
			sum+=x[i];
		} {
			x[i] =sc.nextInt();
			sum+=x[i];
		} x[i] =sc.nextInt() x[i] x i sc.nextInt() sc.nextInt sc sum+=x[i] sum x[i] x i if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum); N<sum N sum System.out.println("-1") System.out.println System.out System System.out "-1" 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 sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int sum = 0;
		int x[] = new int[M];
		for(int i = 0;i<M;i++){
			x[i] =sc.nextInt();
			sum+=x[i];
		}
		if(N<sum)
			System.out.println("-1");
		else
		System.out.println(N-sum);
			
	}

}
