import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    } main {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    } BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); f new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); out new PrintWriter(new OutputStreamWriter(System.out)) StringTokenizer st = new StringTokenizer(f.readLine()); st new StringTokenizer(f.readLine()) int n = Integer.parseInt(st.nextToken()); n Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int k = Integer.parseInt(st.nextToken()); k Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st st = new StringTokenizer(f.readLine()) st new StringTokenizer(f.readLine()) for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        } int i = 0; int i = 0; i 0 i < k i k i++ i++ i {
            n-=Integer.parseInt(st.nextToken());
        } {
            n-=Integer.parseInt(st.nextToken());
        } n-=Integer.parseInt(st.nextToken()) n Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st if(n < 0) n = -1; n < 0 n 0 n = -1 n -1 1 out.println(n) out.println out n out.close() out.close out String[] args args public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    }
} public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        st = new StringTokenizer(f.readLine());
        for(int i = 0; i < k; i++){
            n-=Integer.parseInt(st.nextToken());
        }
        if(n < 0) n = -1;
        out.println(n);

        out.close();
    }
}
