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