import java.util.*;

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

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