import java.util.Scanner;

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

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int M = stdIn.nextInt();
		int[] A = new int[M];
		for(int a = 0; a < M; a++){
			A[a] = stdIn.nextInt();
			N = N - A[a];
		}
		if(N >= 0){
			System.out.println(N);
		}
		else{
			System.out.println(-1);
		}
		stdIn.close();
	}
}