import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			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 n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-1);
		}

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-1);
		}

	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-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 count = 0; count 0 for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			a[i] = scan.nextInt();
			count += a[i];
		} {
			a[i] = scan.nextInt();
			count += a[i];
		} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan count += a[i] count a[i] a i if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-1);
		} n >= count n count {
			System.out.println(n-count);
		} System.out.println(n-count) System.out.println System.out System System.out n-count n count {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-1);
		}

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			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 n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[m];
		int count = 0;
		
		for(int i=0;i<m;i++) {
			a[i] = scan.nextInt();
			count += a[i];
		}
		
		if(n >= count) {
			System.out.println(n-count);
		}else {
			System.out.println(-1);
		}

	}

}
