import java.util.*;

 // Compiler version JDK 11.0.2

 class Main
 {
   public static void main(String args[])
   { 
    Scanner sc= new Scanner(System.in);
    long n = sc.nextLong();
    int m = sc.nextInt();
    int a[]= new int[m];
    long sum =0;
    for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    }
    if(n>=sum)
    System.out.println(n-sum);
    else
    System.out.println("-1");
    
   }
 } import java.util.*; util.* java class Main
 {
   public static void main(String args[])
   { 
    Scanner sc= new Scanner(System.in);
    long n = sc.nextLong();
    int m = sc.nextInt();
    int a[]= new int[m];
    long sum =0;
    for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    }
    if(n>=sum)
    System.out.println(n-sum);
    else
    System.out.println("-1");
    
   }
 } Main public static void main(String args[])
   { 
    Scanner sc= new Scanner(System.in);
    long n = sc.nextLong();
    int m = sc.nextInt();
    int a[]= new int[m];
    long sum =0;
    for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    }
    if(n>=sum)
    System.out.println(n-sum);
    else
    System.out.println("-1");
    
   } main { 
    Scanner sc= new Scanner(System.in);
    long n = sc.nextLong();
    int m = sc.nextInt();
    int a[]= new int[m];
    long sum =0;
    for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    }
    if(n>=sum)
    System.out.println(n-sum);
    else
    System.out.println("-1");
    
   } 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 int a[]= new int[m]; a new int[m] m long sum =0; sum 0 for(int i =0;i<m;i ++)
    {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    } int i =0; int i =0; i 0 i<m i m i ++ i ++ i {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    } {
      a[i]= sc.nextInt();
      sum= sum + a[i];
      
    } a[i]= sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc sum= sum + a[i] sum sum + a[i] sum a[i] a i if(n>=sum)
    System.out.println(n-sum);
    else
    System.out.println("-1"); n>=sum n sum System.out.println(n-sum) System.out.println System.out System System.out n-sum n sum System.out.println("-1") System.out.println System.out System System.out "-1" String args[] args
import java.util.*;

 // Compiler version JDK 11.0.2

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