import java.util.*;
import java.math.*;
import java.io.*;

public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	}
} import java.util.*; util.* java import java.math.*; math.* java import java.io.*; io.* java public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int tt = in.nextInt(); tt in.nextInt() in.nextInt in int sum = 0; sum 0 for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		} int qq=1; int qq=1; qq 1 qq<=tt qq tt qq++ qq++ qq {
			sum += in.nextInt();
		} {
			sum += in.nextInt();
		} sum += in.nextInt() sum in.nextInt() in.nextInt in if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		} sum<=n sum n {
			System.out.println(n-sum);
		} System.out.println(n-sum) System.out.println System.out System System.out n-sum n sum {
			System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	}
} public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	}
} Main
import java.util.*;
import java.math.*;
import java.io.*;

public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int tt = in.nextInt();
		int sum = 0;
		for(int qq=1; qq<=tt; qq++){
			sum += in.nextInt();
		}
		if(sum<=n){
			System.out.println(n-sum);
		}else{
			System.out.println("-1");
		}
	}
}