import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	}
} Main public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	} main {
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int num = input.nextInt(); num input.nextInt() input.nextInt input int n  = input.nextInt(); n input.nextInt() input.nextInt input int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			arr[i] = input.nextInt();
		} {
			arr[i] = input.nextInt();
		} arr[i] = input.nextInt() arr[i] arr i input.nextInt() input.nextInt input int sum = 0; sum 0 for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			sum +=arr[i];
		} {
			sum +=arr[i];
		} sum +=arr[i] sum arr[i] arr i if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1"); num - sum >= 0 num - sum num sum 0 System.out.println(num - sum) System.out.println System.out System System.out num - sum num sum 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 input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	}
} public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		if (num - sum >= 0)
			System.out.println(num - sum);
		else
			System.out.println("-1");
		
	}
}