import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
} 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 X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  } 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 X[]; X X=new int[M] X new int[M] M int total=0; total 0 for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    } int i=0; int i=0; i 0 i<X.length i X.length X X.length i++ i++ i {
    	X[i]=sc.nextInt();
    	total += X[i];
    } {
    	X[i]=sc.nextInt();
    	total += X[i];
    } X[i]=sc.nextInt() X[i] X i sc.nextInt() sc.nextInt sc total += X[i] total X[i] X i int Y=N-total; Y N-total N total if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    } Y>=0 Y 0 {
    	System.out.println(Y);
    } System.out.println(Y) System.out.println System.out System System.out Y {
    	System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" 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 X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
} Main
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N=sc.nextInt();
    int M=sc.nextInt();
    int X[];
    X=new int[M];
    int total=0;
    for (int i=0; i<X.length; i++) {
    	X[i]=sc.nextInt();
    	total += X[i];
    }
    int Y=N-total;
    if(Y>=0) {
    	System.out.println(Y);
    }else {
    	System.out.println("-1");
    }
  }
}