/* 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. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	} main {
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	} Scanner input = new Scanner(System.in); input new Scanner(System.in) int days = input.nextInt(); days input.nextInt() input.nextInt input int assignment = input.nextInt(); assignment input.nextInt() input.nextInt input int daysToComplete= 0; daysToComplete 0 for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		} int i = 0; int i = 0; i 0 i<assignment i assignment i++ i++ i {
		    daysToComplete+=input.nextInt();
		} {
		    daysToComplete+=input.nextInt();
		} daysToComplete+=input.nextInt() daysToComplete input.nextInt() input.nextInt input if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		} assignment>days || daysToComplete>days assignment>days assignment days daysToComplete>days daysToComplete days {
		    System.out.println("-1");
		} System.out.println("-1") System.out.println System.out System System.out "-1" {
		    System.out.println(days- daysToComplete);
		} System.out.println(days- daysToComplete) System.out.println System.out System System.out days- daysToComplete days daysToComplete String[] args args public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	}
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	}
} Main
/* 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. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner input = new Scanner(System.in);
		int days = input.nextInt();
		int assignment = input.nextInt();
		int daysToComplete= 0;
		for(int i = 0;i<assignment;i++){
		    daysToComplete+=input.nextInt();
		}
		if(assignment>days || daysToComplete>days){
		    System.out.println("-1");
		}else {
		    System.out.println(days- daysToComplete);
		}
	}
}
