import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
 
 public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	}
} import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util import java.util.TreeSet; TreeSet java.util import java.math.BigInteger; BigInteger java.math import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collection; Collection java.util import java.util.Collections; Collections java.util import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.LinkedList; LinkedList java.util import java.util.List; List java.util import java.util.ListIterator; ListIterator java.util public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	}
} Main public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	} main {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int m = input.nextInt(); m input.nextInt() input.nextInt input int sum = 0; sum 0 for(int i = 0 ; i < m ; i++)
			sum += input.nextInt(); int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i sum += input.nextInt(); sum += input.nextInt() sum input.nextInt() input.nextInt input System.out.println(n >= sum ? n - sum : -1) System.out.println System.out System System.out n >= sum ? n - sum : -1 n >= sum n sum n - sum n sum -1 1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	}
} Main
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
 
 public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
	    
		//inputs
		int n = input.nextInt();
		int m = input.nextInt();
		int sum = 0;
		for(int i = 0 ; i < m ; i++)
			sum += input.nextInt();
		
		System.out.println(n >= sum ? n - sum : -1);
	}
}