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 study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -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 study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -1);

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

        int study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -1);

    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -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 study = 0; study 0 for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
            study += scanner.nextInt();
        } {
            study += scanner.nextInt();
        } study += scanner.nextInt() study scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner System.out.println(N >= study ? N - study : -1) System.out.println System.out System System.out N >= study ? N - study : -1 N >= study N study N - study N study -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 study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -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 study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -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 study = 0;

        for (int i = 0; i < M; i++) {
            study += scanner.nextInt();
        }
        scanner.close();

        System.out.println(N >= study ? N - study : -1);

    }
}