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

public class Main {


	public static void main(String[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	}
}




class FastScanner {

	BufferedReader br;

	StringTokenizer st;



	public FastScanner() {

		br = new BufferedReader(new InputStreamReader(System.in));

	}



	String next() {

		while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		}

		return st.nextToken();

	}



	int nextInt() {

		return Integer.parseInt(next());

	}



	long nextLong() {

		return Long.parseLong(next());

	}

} 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[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	}
} Main public static void main(String[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	} main {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	} FastScanner fsc = new FastScanner(); fsc new FastScanner() int SV = fsc.nextInt(); SV fsc.nextInt() fsc.nextInt fsc int HW = fsc.nextInt(); HW fsc.nextInt() fsc.nextInt fsc int[] HW_count = new int[HW]; HW_count new int[HW] HW int Total = 0; Total 0 for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		} int i = 0; int i = 0; i 0 HW > i HW i i++ i++ i {
			HW_count[i] = fsc.nextInt();
		} {
			HW_count[i] = fsc.nextInt();
		} HW_count[i] = fsc.nextInt() HW_count[i] HW_count i fsc.nextInt() fsc.nextInt fsc for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		} int num = 0; int num = 0; num 0 HW > num HW num num++ num++ num {
			Total = HW_count[num];
			SV = SV - Total;
		} {
			Total = HW_count[num];
			SV = SV - Total;
		} Total = HW_count[num] Total HW_count[num] HW_count num SV = SV - Total SV SV - Total SV Total if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		} SV < 0 SV 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 if(SV >= 0) {
			System.out.println(SV);
		} SV >= 0 SV 0 {
			System.out.println(SV);
		} System.out.println(SV) System.out.println System.out System System.out SV String[] args args class FastScanner {

	BufferedReader br;

	StringTokenizer st;



	public FastScanner() {

		br = new BufferedReader(new InputStreamReader(System.in));

	}



	String next() {

		while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		}

		return st.nextToken();

	}



	int nextInt() {

		return Integer.parseInt(next());

	}



	long nextLong() {

		return Long.parseLong(next());

	}

} FastScanner BufferedReader br; br StringTokenizer st; st public FastScanner() {

		br = new BufferedReader(new InputStreamReader(System.in));

	} FastScanner {

		br = new BufferedReader(new InputStreamReader(System.in));

	} br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next() {

		while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		}

		return st.nextToken();

	} next {

		while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		}

		return st.nextToken();

	} while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		} st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		} try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			} catch (IOException e) {

				e.printStackTrace();

			} IOException e {

				e.printStackTrace();

			} e.printStackTrace() e.printStackTrace e {

				st = new StringTokenizer(br.readLine());

			} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {

		return Integer.parseInt(next());

	} nextInt {

		return Integer.parseInt(next());

	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong() {

		return Long.parseLong(next());

	} nextLong {

		return Long.parseLong(next());

	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public class Main {


	public static void main(String[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	}
} public class Main {


	public static void main(String[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	}
} 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[] args) {
		FastScanner fsc = new FastScanner();

		int SV = fsc.nextInt();
		int HW = fsc.nextInt();
		int[] HW_count = new int[HW];
		int Total = 0;
		for(int i = 0; HW > i; i++) {
			HW_count[i] = fsc.nextInt();
		}
		//遊べる残日数計算
		for(int num = 0; HW > num; num++ ) {
			Total = HW_count[num];
			SV = SV - Total;
		}

		//宿題が間に合わない
		if(SV < 0) {
			System.out.println(-1);
		}
		//遊べる日数を出力
		else if(SV >= 0) {
			System.out.println(SV);
		}
	}
}




class FastScanner {

	BufferedReader br;

	StringTokenizer st;



	public FastScanner() {

		br = new BufferedReader(new InputStreamReader(System.in));

	}



	String next() {

		while (st == null || !st.hasMoreElements()) {

			try {

				st = new StringTokenizer(br.readLine());

			} catch (IOException e) {

				e.printStackTrace();

			}

		}

		return st.nextToken();

	}



	int nextInt() {

		return Integer.parseInt(next());

	}



	long nextLong() {

		return Long.parseLong(next());

	}

}
