import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int M = Integer.parseInt(sc.next()); M Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] arrayHomework = new int[M]; arrayHomework new int[M] M for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		} int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		} {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		} arrayHomework[i] = Integer.parseInt(sc.next()) arrayHomework[i] arrayHomework i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc N -= arrayHomework[i] N arrayHomework[i] arrayHomework i sc.close() sc.close sc System.out.println(N >= 0 ? N : -1) System.out.println System.out System System.out N >= 0 ? N : -1 N >= 0 N 0 N -1 1 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int[] arrayHomework = new int[M];

		for (int i = 0; i < M; i++) {
			arrayHomework[i] = Integer.parseInt(sc.next());
			N -= arrayHomework[i];
		}
		sc.close();

		System.out.println(N >= 0 ? N : -1);

	}

}
