import java.util.Scanner;
import java.lang.Math;
class Main {
    public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    }
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang class Main {
    public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    }
} Main public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    } main {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int sum = 0; sum 0 for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
          sum += scan.nextInt();
          
      } {
          sum += scan.nextInt();
          
      } sum += scan.nextInt() sum scan.nextInt() scan.nextInt scan if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      } n-sum < 0 n-sum n sum 0 {
          System.out.println(-1);
      } System.out.println(-1) System.out.println System.out System System.out -1 1 {
          System.out.println(n-sum);
      } System.out.println(n-sum) System.out.println System.out System System.out n-sum n sum String args[] args
import java.util.Scanner;
import java.lang.Math;
class Main {
    public static void main(String args[]) {
      Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int m = scan.nextInt();
      int sum = 0;
      for(int i = 0; i < m; i++){
          sum += scan.nextInt();
          
      }
      if(n-sum < 0){
          System.out.println(-1);
      }else{
          System.out.println(n-sum);
      }
    }
}
