import java.util.Scanner;

/*
 * @author Tanzim Ibn Patowary
 * Created  Apr 25, 2020 3:55:23 AM
 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	} main {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	} Scanner mScanner = new Scanner(System.in); mScanner new Scanner(System.in) int N = mScanner.nextInt(); N mScanner.nextInt() mScanner.nextInt mScanner int M= mScanner.nextInt(); M mScanner.nextInt() mScanner.nextInt mScanner int sum = 0; sum 0 for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			int a = mScanner.nextInt();
			sum+=a;
			
		} {
			int a = mScanner.nextInt();
			sum+=a;
			
		} int a = mScanner.nextInt(); a mScanner.nextInt() mScanner.nextInt mScanner sum+=a sum a if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		} sum>N sum N {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(N-sum);
		} System.out.println(N-sum) System.out.println System.out System System.out N-sum N sum String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	}

} Main
import java.util.Scanner;

/*
 * @author Tanzim Ibn Patowary
 * Created  Apr 25, 2020 3:55:23 AM
 */
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner mScanner = new Scanner(System.in);
		int N = mScanner.nextInt();
		int M= mScanner.nextInt();
		int sum = 0;
		for (int i = 0; i < M; i++) {
			int a = mScanner.nextInt();
			sum+=a;
			
		}
		if (sum>N) {
			System.out.println(-1);
		}else {
			System.out.println(N-sum);
		}
	}

}
