import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	} main {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in int ar[] = new int[n]; ar new int[n] n int sum=0; sum 0 for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
          ar[i]=in.nextInt();
          sum+=ar[i];
        } {
          ar[i]=in.nextInt();
          sum+=ar[i];
        } ar[i]=in.nextInt() ar[i] ar i in.nextInt() in.nextInt in sum+=ar[i] sum ar[i] ar i int res = n-sum; res n-sum n sum if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1"); res>=0 res 0 System.out.println(res) System.out.println System.out System System.out res 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) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
	    int n = in.nextInt();
	    int m = in.nextInt();
        int ar[] = new int[n];
      	int sum=0;
      	for(int i=0;i<m;i++){
          ar[i]=in.nextInt();
          sum+=ar[i];
        }
      	int res = n-sum;
      	
        if(res>=0)
          System.out.println(res);
        else
          System.out.println("-1");
          
	}

}
