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