import java.util.Scanner;

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

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

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

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

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

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

        if(N >= 0) {
            System.out.println(N);
        } else {
            System.out.println(-1);
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

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

        if(N >= 0) {
            System.out.println(N);
        } else {
            System.out.println(-1);
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int M = scanner.nextInt(); M scanner.nextInt() scanner.nextInt scanner int[] A = new int[M]; A new int[M] M for(int i = 0; i < A.length; i++) {
            A[i] = scanner.nextInt();
            N -= A[i];
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
            A[i] = scanner.nextInt();
            N -= A[i];
        } {
            A[i] = scanner.nextInt();
            N -= A[i];
        } A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner N -= A[i] N A[i] A i if(N >= 0) {
            System.out.println(N);
        } else {
            System.out.println(-1);
        } N >= 0 N 0 {
            System.out.println(N);
        } System.out.println(N) System.out.println System.out System System.out N {
            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 scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

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

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

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

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

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

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

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