import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  }
 } import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  }
 } Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  } main {
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) List<String> str = new ArrayList<>(); str new ArrayList<>() for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    } int i=0; int i=0; i 0 i<2 i 2 i++ i++ i {
      str.add(scan.nextLine());
    } {
      str.add(scan.nextLine());
    } str.add(scan.nextLine()) str.add str scan.nextLine() scan.nextLine scan String[] a = str.get(0).split(" ",0); a str.get(0).split(" ",0) str.get(0).split str.get(0) str.get str 0 " " 0 String[] b = str.get(1).split(" ",0); b str.get(1).split(" ",0) str.get(1).split str.get(1) str.get str 1 " " 0 int workD = 0; workD 0 for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    } int i=0; int i=0; i 0 i<b.length i b.length b b.length i++ i++ i {
      workD += Integer.parseInt(b[i]);
    } {
      workD += Integer.parseInt(b[i]);
    } workD += Integer.parseInt(b[i]) workD Integer.parseInt(b[i]) Integer.parseInt Integer b[i] b i if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    } Integer.parseInt(a[0]) < workD Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 workD {
      System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" {
      System.out.println(Integer.parseInt(a[0]) - workD);
    } System.out.println(Integer.parseInt(a[0]) - workD) System.out.println System.out System System.out Integer.parseInt(a[0]) - workD Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 workD String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  }
 } public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  }
 } Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    List<String> str = new ArrayList<>();
    
    for (int i=0;i<2;i++){
      str.add(scan.nextLine());
    }
    
    String[] a = str.get(0).split(" ",0);
    String[] b = str.get(1).split(" ",0);
    int workD = 0;
    for(int i=0;i<b.length;i++){
      workD += Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a[0]) < workD ){
      System.out.println("-1");
    } else {
      System.out.println(Integer.parseInt(a[0]) - workD);
    }
  }
 }