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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        System.out.println("-1");
        }
    } main {
		Scanner sc = new Scanner(System.in);
      
       int N =sc.nextInt();
       int M =sc.nextInt();
       int a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        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 a=0; a 0 for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      } int i=1; int i=1; i 1 i<=M i M i++ i++ i {
        a +=sc.nextInt();
      } {
        a +=sc.nextInt();
      } a +=sc.nextInt() a sc.nextInt() sc.nextInt sc if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        System.out.println("-1");
        } N-a >=0 N-a N a 0 {
       System.out.println(N-a);
       } System.out.println(N-a) System.out.println System.out System System.out N-a N a if(N-a <0)  {
        System.out.println("-1");
        } N-a <0 N-a N a 0 {
        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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        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 a=0;
      
      for(int i=1;i<=M;i++){
        a +=sc.nextInt();
      }
       if(N-a >=0){
       System.out.println(N-a);
       }
        else if(N-a <0)  {
        System.out.println("-1");
        }
    }
}