import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int initialBudget = sc.nextInt();
        int numberOfExpenses = sc.nextInt();

        // Check invalid number of expenses
        if (numberOfExpenses < 0) {
            System.out.println("Invalid input");
            return;
        }

        int remainingBalance = initialBudget;

        for (int i = 0; i < numberOfExpenses; i++) {
            int expense = sc.nextInt();

            // If expense is greater than initial budget → print -1 and stop
            if (expense > initialBudget) {
                System.out.println(-1);
                return;
            }

            remainingBalance -= expense;
        }

        System.out.println(remainingBalance);
    }
}
