import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
} Main public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    } main {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] nm = scan.nextLine().split(" "); nm scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " String[] a = scan.nextLine().split(" "); a scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int n = Integer.parseInt(nm[0]); n Integer.parseInt(nm[0]) Integer.parseInt Integer nm[0] nm 0 int m = Integer.parseInt(nm[1]); m Integer.parseInt(nm[1]) Integer.parseInt Integer nm[1] nm 1 for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      		n -= Integer.parseInt(a[i]);
      	} {
      		n -= Integer.parseInt(a[i]);
      	} n -= Integer.parseInt(a[i]) n Integer.parseInt(a[i]) Integer.parseInt Integer a[i] a i if (n < 0) {
      		n = -1;
      	} n < 0 n 0 {
      		n = -1;
      	} n = -1 n -1 1 System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
} public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      	Scanner scan = new Scanner(System.in);
      	String[] nm = scan.nextLine().split(" ");
      	String[] a = scan.nextLine().split(" ");
      	int n = Integer.parseInt(nm[0]);
      	int m = Integer.parseInt(nm[1]);
      	for (int i = 0; i < m; i++) {
      		n -= Integer.parseInt(a[i]);
      	}
      	if (n < 0) {
      		n = -1;
      	}
    	System.out.println(n);
    }
}