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