//package beg_163;

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	} main {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) String[] a = s.nextLine().split(" "); a s.nextLine().split(" ") s.nextLine().split s.nextLine() s.nextLine s " " int b = Integer.parseInt(a[0]); b Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 String[] list = s.nextLine().split(" "); list s.nextLine().split(" ") s.nextLine().split s.nextLine() s.nextLine s " " int count=0; count 0 for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		} String i list {
			int k = Integer.parseInt(i);
			count=count+k;
		} {
			int k = Integer.parseInt(i);
			count=count+k;
		} int k = Integer.parseInt(i); k Integer.parseInt(i) Integer.parseInt Integer i count=count+k count count+k count k if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		} b-count<0 b-count b count 0 {
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(b-count);
		} System.out.println(b-count) System.out.println System.out System System.out b-count b count String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	}

} Main
//package beg_163;

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		String[] a = s.nextLine().split(" ");
		
		int b = Integer.parseInt(a[0]);
		
		String[] list = s.nextLine().split(" ");
		int count=0;
		for (String i: list) {
			int k = Integer.parseInt(i);
			count=count+k;
		}
		if (b-count<0) {
			System.out.println(-1);
		}
		else {
			System.out.println(b-count);
		}
	}

}
