import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int vacation = sc.nextInt(); vacation sc.nextInt() sc.nextInt sc int homework = sc.nextInt(); homework sc.nextInt() sc.nextInt sc int count = 0; count 0 int totalDays = 0; totalDays 0 while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    } count < homework count homework {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    } totalDays += sc.nextInt() totalDays sc.nextInt() sc.nextInt sc count++ count int result = vacation - totalDays; result vacation - totalDays vacation totalDays if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    } result >= 0 result 0 {
	    System.out.println(result);
    } System.out.println(result) System.out.println System.out System System.out result {
	    System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    // 休みの総数
    int vacation = sc.nextInt();

    // 宿題の数
    int homework = sc.nextInt();

    int count = 0;
    int totalDays = 0;
    while (count < homework) {
      // かかる日数
      totalDays += sc.nextInt();
      count++;
    }
    int result = vacation - totalDays;
    if (result >= 0) {
	    System.out.println(result);
    } else {
	    System.out.println("-1");
    }
  }
}