import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	}
}
 import java.util.Scanner; Scanner 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[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	} main {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	} 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[] sum = new int[m]; sum new int[m] m int ans = 0; ans 0 for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		} {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		} sum[i] = sc.nextInt() sum[i] sum i sc.nextInt() sc.nextInt sc ans+=sum[i] ans sum[i] sum i if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		} n-ans < 0 n-ans n ans 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(n-ans);
		} System.out.println(n-ans) System.out.println System.out System System.out n-ans n ans 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[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int[] sum = new int[m];
		
		int ans = 0;
		
		for (int i=0;i<m;i++) {
			sum[i] = sc.nextInt();
			ans+=sum[i];
		}

		if(n-ans < 0) {
			System.out.println(-1);
		} else {
			System.out.println(n-ans);
		}
		

	}
}

