import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int days = sc.nextInt(); days sc.nextInt() sc.nextInt sc int cnt = sc.nextInt(); cnt sc.nextInt() sc.nextInt sc int needDays = 0; needDays 0 for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		} int i = 0; int i = 0; i 0 i < cnt i cnt i++ i++ i {
			needDays += sc.nextInt();
		} {
			needDays += sc.nextInt();
		} needDays += sc.nextInt() needDays sc.nextInt() sc.nextInt sc if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		} days < needDays days needDays {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(days - needDays);
		} System.out.println(days - needDays) System.out.println System.out System System.out days - needDays days needDays String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int days = sc.nextInt();
		int cnt = sc.nextInt();

		int needDays = 0;

		for(int i = 0; i < cnt; i++) {
			needDays += sc.nextInt();
		}

		if(days < needDays) {
			System.out.println(-1);
		} else {
			System.out.println(days - needDays);
		}
	}
}