import java.util.*;

public class Main {
    public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

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

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

        int N = scan.nextInt();
        int M = scan.nextInt();
        int day = 0;
        for (int i = 0; i < M; i++) {
                day += scan.nextInt();
        }
        if(day>N){
            System.out.println(-1);
        }
        else{
            System.out.println(N-day);
        }
    } main {
		Scanner scan = new Scanner(System.in);

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

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

        int N = scan.nextInt();
        int M = scan.nextInt();
        int day = 0;
        for (int i = 0; i < M; i++) {
                day += scan.nextInt();
        }
        if(day>N){
            System.out.println(-1);
        }
        else{
            System.out.println(N-day);
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int M = scan.nextInt();
        int day = 0;
        for (int i = 0; i < M; i++) {
                day += scan.nextInt();
        }
        if(day>N){
            System.out.println(-1);
        }
        else{
            System.out.println(N-day);
        }
    }
}

