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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStreamWriter; OutputStreamWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) 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 int M = Integer.parseInt(st.nextToken()); M Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int[] assign = new int[M]; assign new int[M] M int vacation = 0 vacation 0 sum = 0; sum 0 st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		} int i=0; int i=0; i 0 i<M i M i++ i++ i {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		} {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		} assign[i] = Integer.parseInt(st.nextToken()) assign[i] assign i Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st sum += assign[i] sum assign[i] assign i vacation = N - sum vacation N - sum N sum if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n"); vacation < 0 vacation 0 bw.write(-1 + "\n") bw.write bw -1 + "\n" -1 1 "\n" bw.write(vacation + "\n") bw.write bw vacation + "\n" vacation "\n" bw.flush() bw.flush bw String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	}

} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int N = Integer.parseInt(st.nextToken());
		int M = Integer.parseInt(st.nextToken());
		
		int[] assign = new int[M];
		int vacation = 0, sum = 0;
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<M; i++) {
			assign[i] = Integer.parseInt(st.nextToken());
			sum += assign[i];
		}
		
		vacation = N - sum;
		if(vacation < 0)
			bw.write(-1 + "\n");
		else
			bw.write(vacation + "\n");
		bw.flush();
	}

}
