import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		
		for(int i=0; i<M; i++){
			N -= Integer.parseInt(sc.next());
		}
	
		if(N >= 0) {
			System.out.println(N);
		} else {
			System.out.println(-1);
		}
		
	}

} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		
		for(int i=0; i<M; i++){
			N -= Integer.parseInt(sc.next());
		}
	
		if(N >= 0) {
			System.out.println(N);
		} else {
			System.out.println(-1);
		}
		
	}

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

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		
		for(int i=0; i<M; i++){
			N -= Integer.parseInt(sc.next());
		}
	
		if(N >= 0) {
			System.out.println(N);
		} else {
			System.out.println(-1);
		}
		
	}

}