import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in); 
      int a = input.nextInt();
      int b =input.nextInt();
      for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      }
      if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      }
    }
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in); 
      int a = input.nextInt();
      int b =input.nextInt();
      for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      }
      if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      }
    }
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in); 
      int a = input.nextInt();
      int b =input.nextInt();
      for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      }
      if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      }
    } main {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in); 
      int a = input.nextInt();
      int b =input.nextInt();
      for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      }
      if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      }
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int a = input.nextInt(); a input.nextInt() input.nextInt input int b =input.nextInt(); b input.nextInt() input.nextInt input for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      } int i =0; int i =0; i 0 i<b i b i++ i++ i {
        	int c = input.nextInt();
      		a = a-c;
      } {
        	int c = input.nextInt();
      		a = a-c;
      } int c = input.nextInt(); c input.nextInt() input.nextInt input a = a-c a a-c a c if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      } a<0 a 0 {
        System.out.println ("-1");
      } System.out.println ("-1") System.out.println System.out System System.out "-1" {
        System.out.println(a);
      } System.out.println(a) System.out.println System.out System System.out a String[] args args
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in); 
      int a = input.nextInt();
      int b =input.nextInt();
      for(int i =0; i<b; i++){
        	int c = input.nextInt();
      		a = a-c;
      }
      if(a<0){
        System.out.println ("-1");
      }
      else{
        System.out.println(a);
      }
    }
}