import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		}
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		}
	} main {
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		}
	} try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		} catch(Exception e) {
		} Exception e {
		} {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} 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 sum=0; sum 0 for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    } int i=0; int i=0; i 0 i<m i m i++ i++ i {
		        sum+=sc.nextInt();
		    } {
		        sum+=sc.nextInt();
		    } sum+=sc.nextInt() sum sc.nextInt() sc.nextInt sc n=n-sum n n-sum n sum if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n); n<0 n 0 System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(n) System.out.println System.out System System.out n String[] args args
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		try {
		    Scanner sc=new Scanner(System.in);
		    int n=sc.nextInt();
		    int m=sc.nextInt();
		    int sum=0;
		    for(int i=0;i<m;i++)
		    {
		        sum+=sc.nextInt();
		    }
		    n=n-sum;
		    if(n<0)
		    System.out.println(-1);
		    else
		    System.out.println(n);
		} catch(Exception e) {
		}
	}
}
