import java.util.*;
class Main {
    public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    }
} import java.util.*; util.* java class Main {
    public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    }
} Main public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    } main {
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    } 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 for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        } int i = 0; int i = 0; i 0 i<M i M i++ i++ i {
        	N -= sc.nextInt();
        } {
        	N -= sc.nextInt();
        } N -= sc.nextInt() N sc.nextInt() sc.nextInt sc if (N<0){
          System.out.println(-1);
        }else System.out.println(N); N<0 N 0 {
          System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(N) System.out.println System.out System System.out N String args[] args
import java.util.*;
class Main {
    public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    }
}