import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    }
} import java.util.Scanner; Scanner 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[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    } 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[] A = new int[M]; A new int[M] M int rest = N; rest N for(int i = 0; i < M; i++){
            A[i] = sc.nextInt();
            rest -= A[i];
        } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
            A[i] = sc.nextInt();
            rest -= A[i];
        } {
            A[i] = sc.nextInt();
            rest -= A[i];
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc rest -= A[i] rest A[i] A i if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        } rest < 0 rest 0 {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 {
            System.out.println(rest);
        } System.out.println(rest) System.out.println System.out System System.out rest 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[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    }
} public class Main {

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    }
} Main
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[M];

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

        if(rest < 0){
            System.out.println(-1);
        }else{
            System.out.println(rest);
        }
    }
}