import java.util.Scanner;
public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 } import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 } Main public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	} main {
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int M = stdIn.nextInt(); M stdIn.nextInt() stdIn.nextInt stdIn int Am=0; Am 0 int [] A=new int [M]; A new int [M] M for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		} {
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		} A[i] = stdIn.nextInt() A[i] A i stdIn.nextInt() stdIn.nextInt stdIn Am=Am+A[i] Am Am+A[i] Am A[i] A i for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
  			//System.out.println(A[i]+"A"+i);
  		} {
  			//System.out.println(A[i]+"A"+i);
  		} int ret=N-Am; ret N-Am N Am if(ret<=-1)ret=-1; ret<=-1 ret -1 1 ret=-1 ret -1 1 System.out.println(ret) System.out.println System.out System System.out ret String[]args args public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 } public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 } Main
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 }