import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
} Main public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	} main {
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	} BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); BR new BufferedReader(new InputStreamReader(System.in)) StringTokenizer ST = new StringTokenizer(BR.readLine()); ST new StringTokenizer(BR.readLine()) int N = Integer.parseInt(ST.nextToken()) N Integer.parseInt(ST.nextToken()) Integer.parseInt Integer ST.nextToken() ST.nextToken ST M = Integer.parseInt(ST.nextToken()) M Integer.parseInt(ST.nextToken()) Integer.parseInt Integer ST.nextToken() ST.nextToken ST homeworkDays = 0; homeworkDays 0 ST = new StringTokenizer(BR.readLine()) ST new StringTokenizer(BR.readLine()) for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken()); ; M > 0 M 0 M-- M-- M homeworkDays += Integer.parseInt(ST.nextToken()); homeworkDays += Integer.parseInt(ST.nextToken()) homeworkDays Integer.parseInt(ST.nextToken()) Integer.parseInt Integer ST.nextToken() ST.nextToken ST System.out.println((homeworkDays <= N) ? N - homeworkDays : -1) System.out.println System.out System System.out (homeworkDays <= N) ? N - homeworkDays : -1 (homeworkDays <= N) homeworkDays N N - homeworkDays N homeworkDays -1 1 String[] Arguments Arguments public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
} public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] Arguments) throws IOException 
	{
		BufferedReader BR = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer ST = new StringTokenizer(BR.readLine());
		int N = Integer.parseInt(ST.nextToken()), M = Integer.parseInt(ST.nextToken()), homeworkDays = 0;
		ST = new StringTokenizer(BR.readLine());
		for (; M > 0; M--) homeworkDays += Integer.parseInt(ST.nextToken());
		System.out.println((homeworkDays <= N) ? N - homeworkDays : -1);
	}
}
