import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int syukudai = 0; syukudai 0 int asobi = 0; asobi 0 for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      	syukudai += sc.nextInt();
      
      } {
      	syukudai += sc.nextInt();
      
      } syukudai += sc.nextInt() syukudai sc.nextInt() sc.nextInt sc asobi = n - syukudai asobi n - syukudai n syukudai if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		} asobi < 0 asobi 0 {
			// 出力
			System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
			System.out.println(asobi);
		} System.out.println(asobi) System.out.println System.out System System.out asobi String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力(スペース改行関係なし)
		int n = sc.nextInt();
		int m = sc.nextInt();
        int syukudai = 0;
      	int asobi = 0;
      
      for(int i = 0; i < m ; i++){
      	syukudai += sc.nextInt();
      
      }
      asobi = n - syukudai;
		if(asobi < 0){
			// 出力
			System.out.println(-1);
		}else{
			System.out.println(asobi);
		}
		
	}
}