import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int days = sc.nextInt();
    int works = sc.nextInt();

    int[] workList = new int[works];

    for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    }

    for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    }

    if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    }

    sc.close();

  }

} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int days = sc.nextInt();
    int works = sc.nextInt();

    int[] workList = new int[works];

    for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    }

    for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    }

    if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    }

    sc.close();

  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int days = sc.nextInt();
    int works = sc.nextInt();

    int[] workList = new int[works];

    for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    }

    for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    }

    if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    }

    sc.close();

  } main {
    Scanner sc = new Scanner(System.in);

    int days = sc.nextInt();
    int works = sc.nextInt();

    int[] workList = new int[works];

    for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    }

    for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    }

    if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    }

    sc.close();

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int days = sc.nextInt(); days sc.nextInt() sc.nextInt sc int works = sc.nextInt(); works sc.nextInt() sc.nextInt sc int[] workList = new int[works]; workList new int[works] works for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < works i works i++ i++ i {
      workList[i] = sc.nextInt();
    } {
      workList[i] = sc.nextInt();
    } workList[i] = sc.nextInt() workList[i] workList i sc.nextInt() sc.nextInt sc for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    } int i = 0; int i = 0; i 0 i < workList.length i workList.length workList workList.length i++ i++ i {
      days -= workList[i];
    } {
      days -= workList[i];
    } days -= workList[i] days workList[i] workList i if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    } days < 0 days 0 {
      System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" {
      System.out.println(days);
    } System.out.println(days) System.out.println System.out System System.out days sc.close() sc.close sc String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int days = sc.nextInt();
    int works = sc.nextInt();

    int[] workList = new int[works];

    for (int i = 0; i < works; i++) {
      workList[i] = sc.nextInt();
    }

    for (int i = 0; i < workList.length; i++) {
      days -= workList[i];
    }

    if (days < 0) {
      System.out.println("-1");
    } else {
      System.out.println(days);
    }

    sc.close();

  }

}