import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
class InputReader {
    BufferedReader buf;
    StringTokenizer tok;
 
    public InputReader() {
        buf = new BufferedReader(new InputStreamReader(System.in));
//        try {
//            Path currentRelativePath = Paths.get("");
//            String s = currentRelativePath.toAbsolutePath().toString();
//            String curDir = System.getProperty("user.dir");
//            System.out.println("current dir: " + s);
//            buf = new BufferedReader(new FileReader("/Users/wangdong/Dropbox/LC_Java/src/test/resources/testA.txt"));
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    }
 
    public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
 
    public String next() {
        if (hasNext()) return tok.nextToken();
        return null;
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public  Double nextDouble() {
        return Double.parseDouble(next());
    }
 
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
 
    public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    }
}
 
 
public class Main {
  public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    }
  
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigDecimal; BigDecimal java.math import java.math.BigInteger; BigInteger java.math import java.util.Arrays; Arrays java.util import java.util.StringTokenizer; StringTokenizer java.util class InputReader {
    BufferedReader buf;
    StringTokenizer tok;
 
    public InputReader() {
        buf = new BufferedReader(new InputStreamReader(System.in));
//        try {
//            Path currentRelativePath = Paths.get("");
//            String s = currentRelativePath.toAbsolutePath().toString();
//            String curDir = System.getProperty("user.dir");
//            System.out.println("current dir: " + s);
//            buf = new BufferedReader(new FileReader("/Users/wangdong/Dropbox/LC_Java/src/test/resources/testA.txt"));
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    }
 
    public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
 
    public String next() {
        if (hasNext()) return tok.nextToken();
        return null;
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public  Double nextDouble() {
        return Double.parseDouble(next());
    }
 
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
 
    public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    }
} InputReader BufferedReader buf; buf StringTokenizer tok; tok public InputReader() {
        buf = new BufferedReader(new InputStreamReader(System.in));
//        try {
//            Path currentRelativePath = Paths.get("");
//            String s = currentRelativePath.toAbsolutePath().toString();
//            String curDir = System.getProperty("user.dir");
//            System.out.println("current dir: " + s);
//            buf = new BufferedReader(new FileReader("/Users/wangdong/Dropbox/LC_Java/src/test/resources/testA.txt"));
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    } InputReader {
        buf = new BufferedReader(new InputStreamReader(System.in));
//        try {
//            Path currentRelativePath = Paths.get("");
//            String s = currentRelativePath.toAbsolutePath().toString();
//            String curDir = System.getProperty("user.dir");
//            System.out.println("current dir: " + s);
//            buf = new BufferedReader(new FileReader("/Users/wangdong/Dropbox/LC_Java/src/test/resources/testA.txt"));
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    } buf = new BufferedReader(new InputStreamReader(System.in)) buf new BufferedReader(new InputStreamReader(System.in)) public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    } hasNext {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    } while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        } tok == null || !tok.hasMoreElements() tok == null tok null !tok.hasMoreElements() tok.hasMoreElements() tok.hasMoreElements tok {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        } try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            } catch (Exception e) {
                return false;
            } Exception e {
                return false;
            } return false; false {
                tok = new StringTokenizer(buf.readLine());
            } tok = new StringTokenizer(buf.readLine()) tok new StringTokenizer(buf.readLine()) return true; true public String next() {
        if (hasNext()) return tok.nextToken();
        return null;
    } next {
        if (hasNext()) return tok.nextToken();
        return null;
    } if (hasNext()) return tok.nextToken(); hasNext() hasNext return tok.nextToken(); tok.nextToken() tok.nextToken tok return null; null 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 long nextLong() {
        return Long.parseLong(next());
    } nextLong {
        return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long 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 BigInteger nextBigInteger() {
        return new BigInteger(next());
    } nextBigInteger {
        return new BigInteger(next());
    } return new BigInteger(next()); new BigInteger(next()) public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    } nextBigDecimal {
        return new BigDecimal(next());
    } return new BigDecimal(next()); new BigDecimal(next()) public class Main {
  public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    }
  
} Main public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    } main {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    } InputReader in = new InputReader(); in new InputReader() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = in.nextInt() n in.nextInt() in.nextInt in m = in.nextInt(); m in.nextInt() in.nextInt in int tot = 0; tot 0 int[] times = new int[m]; times new int[m] m for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        } {
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        } times[i] = in.nextInt() times[i] times i in.nextInt() in.nextInt in tot += times[i] tot times[i] times i out.println(tot > n ? -1  :  n-tot) out.println out tot > n ? -1  :  n-tot tot > n tot n -1 1 n-tot n tot out.close() out.close out String[] args args public class Main {
  public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    }
  
} public class Main {
  public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    }
  
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
class InputReader {
    BufferedReader buf;
    StringTokenizer tok;
 
    public InputReader() {
        buf = new BufferedReader(new InputStreamReader(System.in));
//        try {
//            Path currentRelativePath = Paths.get("");
//            String s = currentRelativePath.toAbsolutePath().toString();
//            String curDir = System.getProperty("user.dir");
//            System.out.println("current dir: " + s);
//            buf = new BufferedReader(new FileReader("/Users/wangdong/Dropbox/LC_Java/src/test/resources/testA.txt"));
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    }
 
    public boolean hasNext() {
        while (tok == null || !tok.hasMoreElements()) {
            try {
                tok = new StringTokenizer(buf.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
 
    public String next() {
        if (hasNext()) return tok.nextToken();
        return null;
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public  Double nextDouble() {
        return Double.parseDouble(next());
    }
 
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
 
    public BigDecimal nextBigDecimal() {
        return new BigDecimal(next());
    }
}
 
 
public class Main {
  public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt(), m = in.nextInt();
	//     	out.println(n + " , " + m);
    	int tot = 0; 
    	int[] times = new int[m];
    	for (int i = 0; i < m; i++){
          
          times[i] = in.nextInt();
   		  tot += times[i];
          //out.print(times[i] + " , ");
        }
		out.println(tot > n ? -1  :  n-tot);
        out.close();
    }
  
}
