import java.util.*;

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

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