import java.util.*;

public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }

    private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }

    private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    }
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    } run {
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

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

    private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    }
} public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }

    private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }

    private void run(){
        int N = sc.nextInt();
        int M = sc.nextInt();

        for(int i = 0; i < M; i++){
            N -= sc.nextInt();
        }

        if(N < 0)N = -1;

        System.out.println(N);
        sc.close();
    }
}