import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

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

    public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    }
} Main public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    } main {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    } int N; N int M; M int i = 0; i 0 int Sum = 0; Sum 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) N = scan.nextInt() N scan.nextInt() scan.nextInt scan M = scan.nextInt() M scan.nextInt() scan.nextInt scan int[] A = new int[M]; A new int[M] M while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        } i < M i M {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        } A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan Sum = Sum + A[i] Sum Sum + A[i] Sum A[i] A i i = i + 1 i i + 1 i 1 int Days = N - Sum; Days N - Sum N Sum if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        } Days < 0 Days 0 {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(Days);

        } System.out.println(Days) System.out.println System.out System System.out Days String[] args args public class Main {

    public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    }
} public class Main {

    public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        int N;
        int M;
        int i = 0;
        int Sum = 0;


        Scanner scan = new Scanner(System.in);
        N = scan.nextInt();

        M = scan.nextInt();

        int[] A = new int[M];

        while (i < M) {
           
            A[i] = scan.nextInt();
            Sum = Sum + A[i];
            i = i + 1;
        }
        int Days = N - Sum;

        if (Days < 0) {
            System.out.println("-1");
        } else {
            System.out.println(Days);

        }
    }
}
