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