import java.util.Scanner;

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

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    } main {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int holiday = scanner.nextInt(); holiday scanner.nextInt() scanner.nextInt scanner int num = scanner.nextInt(); num scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        } {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        } holiday -= scanner.nextInt() holiday scanner.nextInt() scanner.nextInt scanner if (holiday < 0) {
                System.out.println(-1);
                return;
            } holiday < 0 holiday 0 {
                System.out.println(-1);
                return;
            } System.out.println(-1) System.out.println System.out System System.out -1 1 return; System.out.println(holiday) System.out.println System.out System System.out holiday String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int holiday = scanner.nextInt();
        int num = scanner.nextInt();

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
} Main
import java.util.Scanner;

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

        for (int i = 0; i < num; i++) {
            holiday -= scanner.nextInt();
            if (holiday < 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(holiday);
    }
}
