import java.util.*;

public class Main{
    public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    }
}
 import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    }
} Main public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    } main {
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    } Long N N M M result; result Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N =sc.nextLong() N sc.nextLong() sc.nextLong sc M =sc.nextLong() M sc.nextLong() sc.nextLong sc result = N result N ArrayList<Long> studyDays = new ArrayList<Long>(); studyDays new ArrayList<Long>() for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        } int i = 0; int i = 0; i 0 i < M i M i ++ i ++ i {
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        } {
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        } studyDays.add(sc.nextLong()) studyDays.add studyDays sc.nextLong() sc.nextLong sc result -= studyDays.get(i) result studyDays.get(i) studyDays.get studyDays i if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        } result < 0 result 0 {
            System.out.println("-1");    
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(result);
        } System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main{
    public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    }
} public class Main{
    public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Long N, M, result;
        Scanner sc = new Scanner(System.in);
        N =sc.nextLong();
        M =sc.nextLong();
        result = N;
        ArrayList<Long> studyDays = new ArrayList<Long>();
        for(int i = 0; i < M; i ++){
            studyDays.add(sc.nextLong());
            result -= studyDays.get(i);
        }
        if(result < 0){
            System.out.println("-1");    
        }else{
            System.out.println(result);
        }
    }
}

