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