import java.util.Scanner;

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

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    int sumA = 0;
    
    for(int i=0; i<M; i++){
      sumA += sc.nextInt();
    }
    
    if(sumA > N){
      System.out.print("-1");
    }else if(sumA == N){
      System.out.print("0");
    }else{
      System.out.print(N - sumA);
    }
    
  }
}