import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    }
} Main public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    } main {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    } try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        } {
            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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) 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 int rest = N; rest N for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
                rest -= A[i];
            } {
                rest -= A[i];
            } rest -= A[i] rest A[i] A i System.out.println(rest < 0 ? -1 : rest) System.out.println System.out System System.out rest < 0 ? -1 : rest rest < 0 rest 0 -1 1 rest String[] args args public class Main {
    public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (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();
            }

            int rest = N;
            for (int i = 0; i < A.length; i++) {
                rest -= A[i];
            }
            System.out.println(rest < 0 ? -1 : rest);
        }
    }
}
