import java.util.*;
import java.io.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    long sum=0;
    int[] arr=new int[m];
    for(int i=0;i<m;i++)
      arr[i]=sc.nextInt();

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

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

     for(int j=0;j<m;j++)
       sum+=arr[j];
    
    long ans=n-sum;
    if(ans<0)
    System.out.println(-1);
    
    else
      System.out.println(ans);
  } main {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    long sum=0;
    int[] arr=new int[m];
    for(int i=0;i<m;i++)
      arr[i]=sc.nextInt();

     for(int j=0;j<m;j++)
       sum+=arr[j];
    
    long ans=n-sum;
    if(ans<0)
    System.out.println(-1);
    
    else
      System.out.println(ans);
  } 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 long sum=0; sum 0 int[] arr=new int[m]; arr new int[m] m for(int i=0;i<m;i++)
      arr[i]=sc.nextInt(); int i=0; int i=0; i 0 i<m i m i++ i++ i arr[i]=sc.nextInt(); arr[i]=sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc for(int j=0;j<m;j++)
       sum+=arr[j]; int j=0; int j=0; j 0 j<m j m j++ j++ j sum+=arr[j]; sum+=arr[j] sum arr[j] arr j long ans=n-sum; ans n-sum n sum if(ans<0)
    System.out.println(-1);
    
    else
      System.out.println(ans); ans<0 ans 0 System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(ans) System.out.println System.out System System.out ans 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();
    long sum=0;
    int[] arr=new int[m];
    for(int i=0;i<m;i++)
      arr[i]=sc.nextInt();

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

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

     for(int j=0;j<m;j++)
       sum+=arr[j];
    
    long ans=n-sum;
    if(ans<0)
    System.out.println(-1);
    
    else
      System.out.println(ans);
  }
} 