import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	} main {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int i = 0; i 0 int total = 0; total 0 int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int M = scan.nextInt(); M scan.nextInt() scan.nextInt scan while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		} true {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		} if(i == M) break; i == M i M break; int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan total += A total A i++ i if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		} N >= total N total {
			N -= total;
			System.out.println(N);
		} N -= total N total System.out.println(N) System.out.println System.out System System.out N if(N < total) {
			System.out.println("-1");
		} N < total N total {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int i = 0;
		int total = 0;
		int N = scan.nextInt(); //夏休みは　Ｎ　日間
		int M = scan.nextInt(); //宿題はM個
		
		while(true) {
			if(i == M) break;
			int A = scan.nextInt(); //日数
			total += A;
			i++;
		}
		if(N >= total) {
			N -= total;
			System.out.println(N);
		} else if(N < total) {
			System.out.println("-1");
		}
		
	}

}