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