import java.util.Scanner;

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

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
} Main public static void main(String[] args){

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	} main {

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	} Scanner scan01 = new Scanner(System.in); scan01 new Scanner(System.in) int dayOff = scan01.nextInt(); dayOff scan01.nextInt() scan01.nextInt scan01 int numHomework = scan01.nextInt(); numHomework scan01.nextInt() scan01.nextInt scan01 Integer dayaHomework[] = new Integer[numHomework]; dayaHomework new Integer[numHomework] numHomework int sumDays = 0; sumDays 0 for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		} int i=0; int i=0; i 0 i<numHomework i numHomework i++ i++ i {
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		} {
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		} dayaHomework[i] = scan01.nextInt() dayaHomework[i] dayaHomework i scan01.nextInt() scan01.nextInt scan01 sumDays = sumDays + dayaHomework[i] sumDays sumDays + dayaHomework[i] sumDays dayaHomework[i] dayaHomework i if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		} dayOff<sumDays dayOff sumDays {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		} dayOff>=sumDays dayOff sumDays {
			System.out.println(dayOff-sumDays);
		} System.out.println(dayOff-sumDays) System.out.println System.out System System.out dayOff-sumDays dayOff sumDays scan01.close() scan01.close scan01 String[] args args public class Main {
	public static void main(String[] args){

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
} public class Main {
	public static void main(String[] args){

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
} Main
import java.util.Scanner;

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

		Scanner scan01 = new Scanner(System.in);
		int dayOff = scan01.nextInt();
		int numHomework = scan01.nextInt();

		Integer dayaHomework[] = new Integer[numHomework];
		int sumDays = 0;
		for(int i=0; i<numHomework; i++){
			dayaHomework[i] = scan01.nextInt();
			sumDays = sumDays + dayaHomework[i];
		}

		if(dayOff<sumDays){
			System.out.println("-1");
		}else if(dayOff>=sumDays){
			System.out.println(dayOff-sumDays);
		}
		scan01.close();
	}
}
