import java.util.Arrays;
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[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    }
} import java.util.Arrays; Arrays java.util 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[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    } 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[] A = new int[M]; A new int[M] M for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length ++i ++i i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc System.out.println(solve(N, A)) System.out.println System.out System System.out solve(N, A) solve N A sc.close() sc.close sc String[] args args static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    } solve {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    } int total = Arrays.stream(A).sum(); total Arrays.stream(A).sum() Arrays.stream(A).sum Arrays.stream(A) Arrays.stream Arrays A return (total <= N) ? (N - total) : -1; (total <= N) ? (N - total) : -1 (total <= N) total N (N - total) N total -1 1 int N N int[] A A public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -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[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    }
} Main
import java.util.Arrays;
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[] A = new int[M];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(N, A));

        sc.close();
    }

    static int solve(int N, int[] A) {
        int total = Arrays.stream(A).sum();

        return (total <= N) ? (N - total) : -1;
    }
}