import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int[] a = new int[m]; a new int[m] m int total = 0; total 0 for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i] = scan.nextInt();
			total += a[i];
		} {
			a[i] = scan.nextInt();
			total += a[i];
		} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan total += a[i] total a[i] a i n -= total n total if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		} n >= 0 n 0 {
			System.out.print(n);
		} System.out.print(n) System.out.print System.out System System.out n {
			System.out.print(-1);
		} System.out.print(-1) System.out.print System.out System System.out -1 1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		
		int total = 0;
		for(int i = 0; i < a.length; i++) {
			a[i] = scan.nextInt();
			total += a[i];
		}
		
		n -= total;
		
		if(n >= 0) {
			System.out.print(n);
		}else {
			System.out.print(-1);
		}
		

	}

}
