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 s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
} 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 s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
} Main public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt(); int m = sc.nextInt(); int s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	} main {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt(); int m = sc.nextInt(); int s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	} 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 s = 0; s 0 int[] a = new int[m]; a new int[m] m while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		} m-- > 0 m-- m 0 {
			a[m] = sc.nextInt();
			s+=a[m];
		} a[m] = sc.nextInt() a[m] a m sc.nextInt() sc.nextInt sc s+=a[m] s a[m] a m int v = n-s; v n-s n s System.out.println(v >= 0 ? v : "-1") System.out.println System.out System System.out v >= 0 ? v : "-1" v >= 0 v 0 v "-1" 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 s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
} public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt(); int m = sc.nextInt(); int s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
} 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 s = 0;
		int[] a = new int[m];
		while (m-- > 0) {
			a[m] = sc.nextInt();
			s+=a[m];
		}
			int v = n-s;
			System.out.println(v >= 0 ? v : "-1");
	}
}