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