import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line1 = br.readLine(); line1 br.readLine() br.readLine br String line2 = br.readLine(); line2 br.readLine() br.readLine br int days = Integer.parseInt(line1.split(" ")[0]); days Integer.parseInt(line1.split(" ")[0]) Integer.parseInt Integer line1.split(" ")[0] line1.split(" ") line1.split line1 " " 0 int homeworks = Integer.parseInt(line1.split(" ")[1]); homeworks Integer.parseInt(line1.split(" ")[1]) Integer.parseInt Integer line1.split(" ")[1] line1.split(" ") line1.split line1 " " 1 String[] costs = line2.split(" "); costs line2.split(" ") line2.split line2 " " int sum = 0; sum 0 for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		} int i = 0; int i = 0; i 0 i < homeworks i homeworks i++ i++ i {
			sum += Integer.parseInt(costs[i]);
		} {
			sum += Integer.parseInt(costs[i]);
		} sum += Integer.parseInt(costs[i]) sum Integer.parseInt(costs[i]) Integer.parseInt Integer costs[i] costs i System.out.println(Math.max(days - sum, -1)) System.out.println System.out System System.out Math.max(days - sum, -1) Math.max Math days - sum days sum -1 1 String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line1 = br.readLine();
		String line2 = br.readLine();
		int days = Integer.parseInt(line1.split(" ")[0]);
		int homeworks = Integer.parseInt(line1.split(" ")[1]);
		String[] costs = line2.split(" ");
		int sum = 0;
		for(int i = 0; i < homeworks; i++) {
			sum += Integer.parseInt(costs[i]);
		}
		System.out.println(Math.max(days - sum, -1));
	}
}
