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

public class Main {

        private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        }
        public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        }
        private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

        private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        }
        public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        }
        private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    }
} Main private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        } solve {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        } Integer m=in.nextInt() m in.nextInt() in.nextInt in n=in.nextInt(); n in.nextInt() in.nextInt in long sum=0; sum 0 for(int i=0;i<n;i++){
                sum+=in.nextInt();
            } int i=0; int i=0; i 0 i<n i n i++ i++ i {
                sum+=in.nextInt();
            } {
                sum+=in.nextInt();
            } sum+=in.nextInt() sum in.nextInt() in.nextInt in System.out.print((m-sum>=0)?m-sum:-1) System.out.print System.out System System.out (m-sum>=0)?m-sum:-1 (m-sum>=0) m-sum m sum 0 m-sum m sum -1 1 InputReader in in PrintWriter out out public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        } main {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out InputReader in = new InputReader(inputStream); in new InputReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) solve(in,out) solve in out out.close() out.close out String args[] args private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    } InputReader public BufferedReader reader; reader public StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public Double nextDouble() {
                return Double.parseDouble(next());
            } nextDouble {
                return Double.parseDouble(next());
            } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {

        private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        }
        public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        }
        private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    }
} public class Main {

        private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        }
        public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        }
        private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    }
} Main

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

public class Main {

        private static void solve(InputReader in, PrintWriter out) {
            Integer m=in.nextInt(),n=in.nextInt();
            long sum=0;
            for(int i=0;i<n;i++){
                sum+=in.nextInt();
            }
            System.out.print((m-sum>=0)?m-sum:-1);
        }
        public static void main(String args[]){
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            InputReader in = new InputReader(inputStream);
            PrintWriter out = new PrintWriter(outputStream);
            solve(in,out);
            out.close();
        }
        private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
            public Double nextDouble() {
                return Double.parseDouble(next());
            }
    }
}