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