import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-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 = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    }
} Main public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    } main {
        //コード
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    } 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 s = 0; s 0 for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	} int i=0; int i=0; i 0 i<M i M i++ i++ i {
    		s = s + sc.nextInt();
    	} {
    		s = s + sc.nextInt();
    	} s = s + sc.nextInt() s s + sc.nextInt() s sc.nextInt() sc.nextInt sc if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	} N>=s N s {
    		System.out.println(N-s);
    	} System.out.println(N-s) System.out.println System.out System System.out N-s N s {
    		System.out.println(-1);
    	} System.out.println(-1) System.out.println System.out System System.out -1 1 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 s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    }
} public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int M = sc.nextInt();

    	int s = 0;

    	for(int i=0;i<M;i++) {
    		s = s + sc.nextInt();
    	}

    	if(N>=s) {
    		System.out.println(N-s);
    	} else {
    		System.out.println(-1);
    	}
    }
}