/* package codechef; // don't place package name! */

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
				Scanner sc=new Scanner (System.in);
		
		int ass=0;
		int nod=sc.nextInt();
		int t=sc.nextInt();
		while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		}
		if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1);
		
	}
} 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
				Scanner sc=new Scanner (System.in);
		
		int ass=0;
		int nod=sc.nextInt();
		int t=sc.nextInt();
		while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		}
		if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1);
		
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
				Scanner sc=new Scanner (System.in);
		
		int ass=0;
		int nod=sc.nextInt();
		int t=sc.nextInt();
		while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		}
		if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1);
		
	} main {
		// your code goes here
				Scanner sc=new Scanner (System.in);
		
		int ass=0;
		int nod=sc.nextInt();
		int t=sc.nextInt();
		while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		}
		if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1);
		
	} Scanner sc=new Scanner (System.in); sc new Scanner (System.in) int ass=0; ass 0 int nod=sc.nextInt(); nod sc.nextInt() sc.nextInt sc int t=sc.nextInt(); t sc.nextInt() sc.nextInt sc while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		} t>0 t 0 {
		    ass=ass+sc.nextInt();
		    t--;
		} ass=ass+sc.nextInt() ass ass+sc.nextInt() ass sc.nextInt() sc.nextInt sc t-- t if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1); nod>=ass nod ass System.out.println(nod-ass) System.out.println System.out System System.out nod-ass nod ass System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args
/* package codechef; // don't place package name! */

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
				Scanner sc=new Scanner (System.in);
		
		int ass=0;
		int nod=sc.nextInt();
		int t=sc.nextInt();
		while (t>0)
		{
		    ass=ass+sc.nextInt();
		    t--;
		}
		if(nod>=ass)
		System.out.println(nod-ass);
		else System.out.println(-1);
		
	}
}
