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