import java.util.Scanner;
public class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(answer());
	}
	public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	}
} import java.util.Scanner; Scanner java.util public class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(answer());
	}
	public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	}
} Main static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
		System.out.println(answer());
	} main {
		System.out.println(answer());
	} System.out.println(answer()) System.out.println System.out System System.out answer() answer String[] args args public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	} answer {
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	} int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int[] arr= new int[m]; arr new int[m] m int sum = 0; sum 0 for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		} int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i {
			arr[i] = scan.nextInt();
			sum += arr[i];
		} {
			arr[i] = scan.nextInt();
			sum += arr[i];
		} arr[i] = scan.nextInt() arr[i] arr i scan.nextInt() scan.nextInt scan sum += arr[i] sum arr[i] arr i return n >= sum ?n-sum:-1; n >= sum ?n-sum:-1 n >= sum n sum n-sum n sum -1 1 public class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(answer());
	}
	public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	}
} public class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(answer());
	}
	public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	}
} Main
import java.util.Scanner;
public class Main{
	static Scanner scan = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(answer());
	}
	public static int answer(){
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] arr= new int[m];
		int sum = 0;
		for(int i = 0 ; i < m ; i++){
			arr[i] = scan.nextInt();
			sum += arr[i];
		}
		return n >= sum ?n-sum:-1;
	}
}