import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
} Main public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    } main {
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int arr[] = new int[M]; arr new int[M] M int sumday = 0; sumday 0 for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		} {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		} arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc sumday += arr[i] sumday arr[i] arr i if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		} sumday>N sumday N {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(N-sumday);
		} System.out.println(N-sumday) System.out.println System.out System System.out N-sumday N sumday sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
} public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int arr[] = new int[M];
		int sumday = 0;
		for (int i = 0; i < arr.length; i++) {
			arr[i] = sc.nextInt();
			sumday += arr[i];
		}

		if (sumday>N) {
			System.out.println(-1);
		} else {
			System.out.println(N-sumday);
		}
		sc.close();
    }	
		
}