import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int total_holiday = sc.nextInt();
        int total_homework = sc.nextInt();
        int total = 0;
        
        for(int i = 0;i < total_homework;i++){
            total += sc.nextInt();
        }
        if(total_holiday >= total){
            System.out.println(total_holiday-total);
        }else{
            System.out.println(-1);
        }
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int total_holiday = sc.nextInt();
        int total_homework = sc.nextInt();
        int total = 0;
        
        for(int i = 0;i < total_homework;i++){
            total += sc.nextInt();
        }
        if(total_holiday >= total){
            System.out.println(total_holiday-total);
        }else{
            System.out.println(-1);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int total_holiday = sc.nextInt();
        int total_homework = sc.nextInt();
        int total = 0;
        
        for(int i = 0;i < total_homework;i++){
            total += sc.nextInt();
        }
        if(total_holiday >= total){
            System.out.println(total_holiday-total);
        }else{
            System.out.println(-1);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int total_holiday = sc.nextInt();
        int total_homework = sc.nextInt();
        int total = 0;
        
        for(int i = 0;i < total_homework;i++){
            total += sc.nextInt();
        }
        if(total_holiday >= total){
            System.out.println(total_holiday-total);
        }else{
            System.out.println(-1);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int total_holiday = sc.nextInt(); total_holiday sc.nextInt() sc.nextInt sc int total_homework = sc.nextInt(); total_homework sc.nextInt() sc.nextInt sc int total = 0; total 0 for(int i = 0;i < total_homework;i++){
            total += sc.nextInt();
        } int i = 0; int i = 0; i 0 i < total_homework i total_homework i++ i++ i {
            total += sc.nextInt();
        } {
            total += sc.nextInt();
        } total += sc.nextInt() total sc.nextInt() sc.nextInt sc if(total_holiday >= total){
            System.out.println(total_holiday-total);
        }else{
            System.out.println(-1);
        } total_holiday >= total total_holiday total {
            System.out.println(total_holiday-total);
        } System.out.println(total_holiday-total) System.out.println System.out System System.out total_holiday-total total_holiday total {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args
import java.util.Scanner;

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