import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	}
} Main public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	} main {
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  } {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  } n -= sc.nextLong() n sc.nextLong() sc.nextLong sc if(n < 0) {
			  n = -1;
			  break;
		  } n < 0 n 0 {
			  n = -1;
			  break;
		  } n = -1 n -1 1 break; System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	}
} public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
	  long n = sc.nextLong();
	  int m = sc.nextInt();
	  for(int i = 0; i < m; i++) {
		  n -= sc.nextLong();
		  if(n < 0) {
			  n = -1;
			  break;
		  }
	  }
	  System.out.println(n);
	}
}