import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    }
} import java.io.File; File java.io import java.io.FileInputStream; FileInputStream java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    } main {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int holidays = sc.nextInt(); holidays sc.nextInt() sc.nextInt sc int homeworks = sc.nextInt(); homeworks sc.nextInt() sc.nextInt sc int sum = 0; sum 0 for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        } int i=0; int i=0; i 0 i<homeworks i homeworks i++ i++ i {
            sum += sc.nextInt();
        } {
            sum += sc.nextInt();
        } sum += sc.nextInt() sum sc.nextInt() sc.nextInt sc if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum); sum > holidays sum holidays System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(holidays - sum) System.out.println System.out System System.out holidays - sum holidays sum String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    }
} Main
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int holidays = sc.nextInt();
        int homeworks = sc.nextInt();

        int sum = 0;
        for (int i=0; i<homeworks; i++) {
            sum += sc.nextInt();
        }

        if (sum > holidays) System.out.println(-1);
        else System.out.println(holidays - sum);
    }
}
